Revision 4c6a2323
Added by koszko over 1 year ago
test/unit/test_content.py | ||
---|---|---|
33 | 33 |
'''; |
34 | 34 |
this.haketilo_secret = "abracadabra"; |
35 | 35 |
this.haketilo_pattern_tree = {}; |
36 |
this.haketilo_defualt_allow = false;
|
|
36 |
this.haketilo_default_allow = false;
|
|
37 | 37 |
|
38 | 38 |
if (this.haketilo_content_script_main) |
39 | 39 |
this.haketilo_content_script_main(); |
... | ... | |
69 | 69 |
|
70 | 70 |
async function mock_payload_ok([type, res_id]) { |
71 | 71 |
if (type === "indexeddb_files") |
72 |
return [1, 2].map(n => `window.haketilo_injected_${n} = ${n}${n};`);
|
|
72 |
return {files: [1, 2].map(n => `window.hak_injected_${n} = ${n};`)};
|
|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
if (/payload_error/.test(document.URL)) { |
... | ... | |
162 | 162 |
|
163 | 163 |
def vars_made_by_payload(driver): |
164 | 164 |
vars_values = driver.execute_script( |
165 |
'return [1, 2].map(n => window[`haketilo_injected_${n}`]);'
|
|
165 |
'return [1, 2].map(n => window[`hak_injected_${n}`]);' |
|
166 | 166 |
) |
167 | 167 |
if vars_values != [None, None]: |
168 | 168 |
return vars_values |
... | ... | |
174 | 174 |
} |
175 | 175 |
elif target2 == 'payload_ok': |
176 | 176 |
vars_values = WebDriverWait(driver, 10).until(vars_made_by_payload) |
177 |
assert vars_values == [11, 22]
|
|
177 |
assert vars_values == [1, 2]
|
|
178 | 178 |
|
179 | 179 |
@pytest.mark.ext_data({'content_script': content_script}) |
180 | 180 |
@pytest.mark.usefixtures('webextension') |
Also available in: Unified diff
make Haketilo buildable again (for Mozilla)
How cool it is to throw away 5755 lines of code...