OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 function optionsPageLoaded() { | 5 function optionsPageLoaded() { |
6 var hasLoaded = false; | 6 var hasLoaded = false; |
7 chrome.extension.getViews().forEach(function(view) { | 7 chrome.extension.getViews().forEach(function(view) { |
8 if (view.document.location.pathname == '/options.html') { | 8 if (view.document.location.pathname == '/options.html') { |
9 chrome.test.assertEq(false, hasLoaded); | 9 chrome.test.assertEq(false, hasLoaded); |
10 hasLoaded = view.loaded; | 10 hasLoaded = view.loaded; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 chrome.test.assertTrue(evt.height >= 499); | 129 chrome.test.assertTrue(evt.height >= 499); |
130 chrome.test.assertTrue(evt.width <= 501); | 130 chrome.test.assertTrue(evt.width <= 501); |
131 chrome.test.assertTrue(evt.height <= 501); | 131 chrome.test.assertTrue(evt.height <= 501); |
132 done(); | 132 done(); |
133 } finally { | 133 } finally { |
134 document.body.removeChild(extensionoptions); | 134 document.body.removeChild(extensionoptions); |
135 } | 135 } |
136 }; | 136 }; |
137 | 137 |
138 document.body.appendChild(extensionoptions); | 138 document.body.appendChild(extensionoptions); |
| 139 }, |
| 140 |
| 141 function externalLinksOpenInNewTab() { |
| 142 var done = chrome.test.listenForever(chrome.runtime.onMessage, |
| 143 function(message, sender, sendResponse) { |
| 144 if (message == 'ready') { |
| 145 sendResponse('externalLinksOpenInNewTab'); |
| 146 } else if (message == 'done') { |
| 147 try { |
| 148 chrome.tabs.query({url: 'http://www.chromium.org/'}, function(tabs) { |
| 149 chrome.test.assertEq(1, tabs.length); |
| 150 chrome.test.assertEq('http://www.chromium.org/', tabs[0].url); |
| 151 done(); |
| 152 }); |
| 153 } finally { |
| 154 document.body.removeChild(extensionoptions); |
| 155 } |
| 156 } |
| 157 }); |
| 158 |
| 159 var extensionoptions = document.createElement('extensionoptions'); |
| 160 extensionoptions.setAttribute('extension', chrome.runtime.id); |
| 161 document.body.appendChild(extensionoptions); |
139 } | 162 } |
140 ]); | 163 ]); |
OLD | NEW |