OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 var theOnlyTestDone = null; |
| 6 |
| 7 function inject(callback) { |
| 8 chrome.tabs.executeScript({ code: "true" }, callback); |
| 9 } |
| 10 |
| 11 chrome.browserAction.onClicked.addListener(function() { |
| 12 inject(function() { |
| 13 chrome.test.assertNoLastError(); |
| 14 chrome.test.notifyPass(); |
| 15 }); |
| 16 }); |
| 17 |
| 18 chrome.webNavigation.onCompleted.addListener(function(details) { |
| 19 inject(function() { |
| 20 chrome.test.assertLastError("Access to extension API denied."); |
| 21 if (details.url.indexOf("final_page") >= 0) |
| 22 theOnlyTestDone(); |
| 23 else |
| 24 chrome.test.notifyPass(); |
| 25 }); |
| 26 }); |
| 27 |
| 28 chrome.test.runTests([ |
| 29 function theOnlyTest() { |
| 30 // This will keep the test alive until the final callback is run. |
| 31 theOnlyTestDone = chrome.test.callbackAdded(); |
| 32 } |
| 33 ]); |
OLD | NEW |