1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var assertEq = chrome.test.assertEq;
6 var callbackPass = chrome.test.callbackPass;
10 // window.onload in a.html calls this function.
13 function pageUrl(letter) {
14 return chrome.extension.getURL(letter + ".html");
17 function withTabOnReload(fn) {
18 var done = callbackPass();
19 onTabLoad = function(url) {
20 assertEq(pageUrl("a"), url);
27 function testReload1() {
28 withTabOnReload(function () {
33 function testReload2() {
34 withTabOnReload(function () {
35 chrome.tabs.reload(null);
39 function testReload2() {
40 withTabOnReload(function () {
41 chrome.tabs.reload(myTabId);
45 function testReload4() {
46 withTabOnReload(function () {
47 chrome.tabs.reload(myTabId, {});
51 function testReload5() {
52 withTabOnReload(function () {
53 chrome.tabs.reload(myTabId, {}, callbackPass());
57 function testReload6() {
58 withTabOnReload(function () {
59 chrome.tabs.reload(myTabId, { bypassCache: false }, callbackPass());
63 function testReload7() {
64 withTabOnReload(function () {
65 chrome.tabs.reload(myTabId, { bypassCache: true }, callbackPass());
70 onTabLoad = function(url) {
71 chrome.test.runTests(allTests);
74 chrome.tabs.create({url: pageUrl("a")}, function(tab) {
76 chrome.tabs.update(myTabId, { selected: true });