зеркало из https://github.com/mozilla/gecko-dev.git
Bug 598383 - Utilities for Panorama tests [r=dolske,a=test]
--HG-- extra : rebase_source : d62cc3b5bb24a98fd22427f76bce9ccc69fcc76c
This commit is contained in:
Родитель
ef24a45fb3
Коммит
b315cf565e
|
@ -68,6 +68,7 @@ _BROWSER_FILES = \
|
|||
browser_tabview_startup_transitions.js \
|
||||
browser_tabview_undo_group.js \
|
||||
browser_tabview_firstrun_pref.js \
|
||||
head.js \
|
||||
search1.html \
|
||||
search2.html \
|
||||
$(NULL)
|
||||
|
|
|
@ -59,7 +59,7 @@ function test() {
|
|||
"The currently selected tab should be the first tab in the groupItemOne");
|
||||
|
||||
// create another group with a tab.
|
||||
let groupItemTwo = createEmptyGroupItem(contentWindow, 200);
|
||||
let groupItemTwo = createEmptyGroupItem(contentWindow, 300, 300, 200);
|
||||
|
||||
let onTabViewHidden = function() {
|
||||
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
|
@ -111,16 +111,3 @@ function testGroupSwitch(contentWindow, groupItemOne, groupItemTwo) {
|
|||
|
||||
finish();
|
||||
}
|
||||
|
||||
function createEmptyGroupItem(contentWindow, padding) {
|
||||
let pageBounds = contentWindow.Items.getPageBounds();
|
||||
pageBounds.inset(padding, padding);
|
||||
|
||||
let box = new contentWindow.Rect(pageBounds);
|
||||
box.width = 300;
|
||||
box.height = 300;
|
||||
|
||||
let emptyGroupItem = new contentWindow.GroupItem([], { bounds: box });
|
||||
|
||||
return emptyGroupItem;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ function testEmptyGroupItem(contentWindow) {
|
|||
let groupItemCount = contentWindow.GroupItems.groupItems.length;
|
||||
|
||||
// create empty group item
|
||||
let emptyGroupItem = createEmptyGroupItem(contentWindow, 100);
|
||||
let emptyGroupItem = createEmptyGroupItem(contentWindow, 300, 300, 100, true);
|
||||
ok(emptyGroupItem.isEmpty(), "This group is empty");
|
||||
|
||||
is(contentWindow.GroupItems.groupItems.length, ++groupItemCount,
|
||||
|
@ -89,7 +89,7 @@ function testEmptyGroupItem(contentWindow) {
|
|||
}
|
||||
|
||||
function testGroupItemWithTabItem(contentWindow) {
|
||||
let groupItem = createEmptyGroupItem(contentWindow, 200);
|
||||
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200, true);
|
||||
let tabItemCount = 0;
|
||||
|
||||
let onTabViewHidden = function() {
|
||||
|
@ -161,17 +161,3 @@ function testGroupItemWithTabItem(contentWindow) {
|
|||
|
||||
EventUtils.synthesizeMouse(newTabButton[0], 1, 1, {}, contentWindow);
|
||||
}
|
||||
|
||||
function createEmptyGroupItem(contentWindow, padding) {
|
||||
let pageBounds = contentWindow.Items.getPageBounds();
|
||||
pageBounds.inset(padding, padding);
|
||||
|
||||
let box = new contentWindow.Rect(pageBounds);
|
||||
box.width = 300;
|
||||
box.height = 300;
|
||||
|
||||
let emptyGroupItem = new contentWindow.GroupItem([], { bounds: box,
|
||||
immediately: true });
|
||||
|
||||
return emptyGroupItem;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ function onTabViewWindowLoaded() {
|
|||
is(contentWindow.GroupItems.getOrphanedTabs().length, 0, "No orphaned tabs");
|
||||
|
||||
// 2) create a group, add a blank tab
|
||||
let groupItem = createEmptyGroupItem(contentWindow, 200);
|
||||
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200);
|
||||
|
||||
let onTabViewHidden = function() {
|
||||
newWin.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
|
@ -110,19 +110,6 @@ function onTabViewWindowLoaded() {
|
|||
EventUtils.sendMouseEvent({ type: "click" }, newTabButton[0], contentWindow);
|
||||
}
|
||||
|
||||
function createEmptyGroupItem(contentWindow, padding) {
|
||||
let pageBounds = contentWindow.Items.getPageBounds();
|
||||
pageBounds.inset(padding, padding);
|
||||
|
||||
let box = new contentWindow.Rect(pageBounds);
|
||||
box.width = 300;
|
||||
box.height = 300;
|
||||
|
||||
let emptyGroupItem = new contentWindow.GroupItem([], { bounds: box });
|
||||
|
||||
return emptyGroupItem;
|
||||
}
|
||||
|
||||
function whenWindowObservesOnce(win, topic, callback) {
|
||||
let windowWatcher =
|
||||
Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the utilities for tabview.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Raymond Lee <raymond@appcoast.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function createEmptyGroupItem(contentWindow, width, height, padding, noAnimation) {
|
||||
let pageBounds = contentWindow.Items.getPageBounds();
|
||||
pageBounds.inset(padding, padding);
|
||||
|
||||
let box = new contentWindow.Rect(pageBounds);
|
||||
box.width = width;
|
||||
box.height = height;
|
||||
|
||||
let immediately = noAnimation ? true: false;
|
||||
let emptyGroupItem =
|
||||
new contentWindow.GroupItem([], { bounds: box, immediately: immediately });
|
||||
|
||||
return emptyGroupItem;
|
||||
}
|
Загрузка…
Ссылка в новой задаче