| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 document.body.removeChild(extensionoptions); | 115 document.body.removeChild(extensionoptions); |
| 116 done(); | 116 done(); |
| 117 } | 117 } |
| 118 }); | 118 }); |
| 119 | 119 |
| 120 var extensionoptions = document.createElement('extensionoptions'); | 120 var extensionoptions = document.createElement('extensionoptions'); |
| 121 extensionoptions.setAttribute('extension', chrome.runtime.id); | 121 extensionoptions.setAttribute('extension', chrome.runtime.id); |
| 122 document.body.appendChild(extensionoptions); | 122 document.body.appendChild(extensionoptions); |
| 123 }, | 123 }, |
| 124 | 124 |
| 125 function autosizedGuestIsWithinSizeConstraints() { | |
| 126 var done = chrome.test.callbackAdded(); | |
| 127 | |
| 128 var extensionoptions = new ExtensionOptions(); | |
| 129 extensionoptions.extension = chrome.runtime.id; | |
| 130 extensionoptions.autosize = 'on'; | |
| 131 extensionoptions.minheight = 499; | |
| 132 extensionoptions.minwidth = 499; | |
| 133 extensionoptions.maxheight = 501; | |
| 134 extensionoptions.maxwidth = 501; | |
| 135 | |
| 136 extensionoptions.onsizechanged = function(evt) { | |
| 137 try { | |
| 138 chrome.test.assertTrue(evt.newWidth >= 499); | |
| 139 chrome.test.assertTrue(evt.newHeight >= 499); | |
| 140 chrome.test.assertTrue(evt.newWidth <= 501); | |
| 141 chrome.test.assertTrue(evt.newHeight <= 501); | |
| 142 done(); | |
| 143 } finally { | |
| 144 document.body.removeChild(extensionoptions); | |
| 145 } | |
| 146 }; | |
| 147 | |
| 148 document.body.appendChild(extensionoptions); | |
| 149 }, | |
| 150 | |
| 151 function externalLinksOpenInNewTab() { | 125 function externalLinksOpenInNewTab() { |
| 152 var done = chrome.test.listenForever(chrome.runtime.onMessage, | 126 var done = chrome.test.listenForever(chrome.runtime.onMessage, |
| 153 function(message, sender, sendResponse) { | 127 function(message, sender, sendResponse) { |
| 154 assertSenderIsOptionsPage(sender); | 128 assertSenderIsOptionsPage(sender); |
| 155 | 129 |
| 156 if (message == 'ready') { | 130 if (message == 'ready') { |
| 157 sendResponse('externalLinksOpenInNewTab'); | 131 sendResponse('externalLinksOpenInNewTab'); |
| 158 } else if (message == 'done') { | 132 } else if (message == 'done') { |
| 159 try { | 133 try { |
| 160 chrome.tabs.query({url: 'http://www.chromium.org/'}, function(tabs) { | 134 chrome.tabs.query({url: 'http://www.chromium.org/'}, function(tabs) { |
| 161 chrome.test.assertEq(1, tabs.length); | 135 chrome.test.assertEq(1, tabs.length); |
| 162 chrome.test.assertEq('http://www.chromium.org/', tabs[0].url); | 136 chrome.test.assertEq('http://www.chromium.org/', tabs[0].url); |
| 163 done(); | 137 done(); |
| 164 }); | 138 }); |
| 165 } finally { | 139 } finally { |
| 166 document.body.removeChild(extensionoptions); | 140 document.body.removeChild(extensionoptions); |
| 167 } | 141 } |
| 168 } | 142 } |
| 169 }); | 143 }); |
| 170 | 144 |
| 171 var extensionoptions = document.createElement('extensionoptions'); | 145 var extensionoptions = document.createElement('extensionoptions'); |
| 172 extensionoptions.setAttribute('extension', chrome.runtime.id); | 146 extensionoptions.setAttribute('extension', chrome.runtime.id); |
| 173 document.body.appendChild(extensionoptions); | 147 document.body.appendChild(extensionoptions); |
| 174 } | 148 } |
| 175 ]); | 149 ]); |
| OLD | NEW |