Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Tests that the eyedropper command works
6 const TESTCASE_URI = TEST_BASE + "color-block.html";
7 const DIV_COLOR = "#0000FF";
9 function test() {
10 return Task.spawn(spawnTest).then(finish, helpers.handleError);
11 }
13 function spawnTest() {
14 let options = yield helpers.openTab(TESTCASE_URI);
15 yield helpers.openToolbar(options);
17 yield helpers.audit(options, [
18 {
19 setup: "eyedropper",
20 check: {
21 input: "eyedropper"
22 },
23 exec: { output: "" }
24 },
25 ]);
27 yield inspectAndWaitForCopy();
29 yield helpers.closeToolbar(options);
30 yield helpers.closeTab(options);
31 }
33 function inspectAndWaitForCopy() {
34 let deferred = promise.defer();
36 waitForClipboard(DIV_COLOR, () => {
37 inspectPage(); // setup: inspect the page
38 }, deferred.resolve, deferred.reject);
40 return deferred.promise;
41 }
43 function inspectPage() {
44 let target = content.document.getElementById("test");
45 let win = content.window;
47 EventUtils.synthesizeMouse(target, 20, 20, { type: "mousemove" }, win);
49 let dropper = EyedropperManager.getInstance(window);
51 return dropperLoaded(dropper).then(() => {
52 EventUtils.synthesizeMouse(target, 30, 30, { type: "mousemove" }, win);
54 EventUtils.synthesizeMouse(target, 30, 30, {}, win);
55 });
56 }