Bug 485855 - "--browser-chrome Mochitests on Fennec [tabs]" [r=mfinkle]

This commit is contained in:
Zadkiel 2009-09-01 16:01:00 -05:00
parent 1e2fa7414a
commit adf5c1932e
4 changed files with 68 additions and 0 deletions

View File

@ -46,6 +46,9 @@ include $(topsrcdir)/config/rules.mk
_BROWSER_FILES = \
browser_mainui.js \
browser_tabs.js \
browser_blank_01.html \
browser_blank_02.html \
$(NULL)
libs:: $(_BROWSER_FILES)

View File

@ -0,0 +1,6 @@
<html>
<title>Browser Blank Page 01</title>
<body>
Browser Blank Page 01
</body>
</html>

View File

@ -0,0 +1,6 @@
<html>
<title>Browser Blank Page 02</title>
<body>
Browser Blank Page 02
</body>
</html>

View File

@ -0,0 +1,53 @@
let iosvc = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
let testURL_01 = "chrome://mochikit/content/browser/mobile/chrome/browser_blank_01.html";
let testURL_02 = "chrome://mochikit/content/browser/mobile/chrome/browser_blank_02.html";
var new_tab_01;
var new_tab_02;
function load_tabs() {
var tabs_size_old = window.Browser._tabs.length -1;
var new_tab = window.Browser.getTabAtIndex(1);
var new_tab_URI = window.Browser.selectedTab.browser.currentURI.spec;
is(new_tab_URI, testURL_01, "URL Matches newly created Tab");
//Close new tab
var close_tab = window.Browser.closeTab(new_tab);
var tabs_size_new = window.Browser._tabs.length;
is(tabs_size_new, tabs_size_old, "Tab Closed");
//Add new tab
new_tab_01 = window.Browser.addTab(testURL_01,false);
//Check tab switch
new_tab_01.browser.addEventListener("load", tab_switch_01, true);
}
function tab_switch_01(){
window.BrowserUI.selectTab(new_tab_01);
is(window.Browser.selectedTab.browser.currentURI.spec, testURL_01, "Tab Switch 01 URL Matches");
//Add new tab
new_tab_02 = window.Browser.addTab(testURL_02,false);
new_tab_02.browser.addEventListener("load", tab_switch_02, true);
}
function tab_switch_02(){
window.BrowserUI.selectTab(new_tab_02);
is(window.Browser.selectedTab.browser.currentURI.spec, testURL_02, "Tab Switch 02 URL Matches");
window.BrowserUI.selectTab(new_tab_01);
is(window.Browser.selectedTab.browser.currentURI.spec, testURL_01, "Tab Switch 01 URL Matches");
//Close new tab
window.Browser.closeTab(new_tab_01);
window.Browser.closeTab(new_tab_02);
}
function test(){
//Add new tab
var new_tab = window.Browser.addTab(testURL_01,true);
ok(new_tab, "Tab Opened");
//Check currentURI.spec
new_tab.browser.addEventListener("load", load_tabs , true);
}