Bug 1015721 - Add test. r=jimm

This commit is contained in:
Markus Stange 2014-08-20 17:14:58 +02:00
Родитель 477587277a
Коммит ee6dab8974
2 изменённых файлов: 57 добавлений и 0 удалений

Просмотреть файл

@ -276,6 +276,8 @@ skip-if = e10s # Bug 921959 - reload with LOAD_FLAGS_ALLOW_MIXED_CONTENT fails i
skip-if = buildapp == "mulet" || e10s # Bug ?????? - test directly manipulates content (strange - gets an element from a child which it tries to treat as a string, but that fails)
[browser_bug970746.js]
skip-if = e10s # Bug ?????? - test directly manipulates content (directly gets elements from the content)
[browser_bug1015721.js]
skip-if = e10s # Bug 1056146 - FullZoomHelper uses promiseTabLoadEvent() which isn't e10s friendly
[browser_canonizeURL.js]
skip-if = e10s # Bug ?????? - [JavaScript Error: "Error in AboutHome.sendAboutHomeData TypeError: target.messageManager is undefined" {file: "resource:///modules/AboutHome.jsm" line: 208}]
[browser_contentAreaClick.js]

Просмотреть файл

@ -0,0 +1,55 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const TEST_PAGE = "http://example.org/browser/browser/base/content/test/general/zoom_test.html";
var gTab1, gTab2, gLevel1;
function test() {
waitForExplicitFinish();
Task.spawn(function () {
gTab1 = gBrowser.addTab();
gTab2 = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
yield FullZoomHelper.load(gTab1, TEST_PAGE);
yield FullZoomHelper.load(gTab2, TEST_PAGE);
}).then(zoomTab1, FullZoomHelper.failAndContinue(finish));
}
function dispatchZoomEventToBrowser(browser) {
EventUtils.synthesizeWheel(browser.contentDocument.documentElement, 10, 10, {
ctrlKey: true, deltaY: -1, deltaMode: WheelEvent.DOM_DELTA_LINE
}, browser.contentWindow);
}
function zoomTab1() {
Task.spawn(function () {
is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
let browser1 = gBrowser.getBrowserForTab(gTab1);
dispatchZoomEventToBrowser(browser1);
gLevel1 = ZoomManager.getZoomForBrowser(browser1);
ok(gLevel1 > 1, "New zoom for tab 1 should be greater than 1");
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
FullZoomHelper.zoomTest(gTab2, gLevel1, "Tab 2 should have zoomed along with tab 1");
}).then(finishTest, FullZoomHelper.failAndContinue(finish));
}
function finishTest() {
Task.spawn(function () {
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
FullZoom.reset();
yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
FullZoom.reset();
yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab2);
}).then(finish, FullZoomHelper.failAndContinue(finish));
}