OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 // This script is opened inside a <extensionoptions> guest view. When opened, | |
6 // it sends a message back to the test page, which responds with which test case | |
7 // it is running. The options page then runs the appropriate code for the | |
8 // specified test case. | |
9 chrome.runtime.sendMessage('ready', function(command) { | |
10 switch(command) { | |
11 case 'canCreateExtensionOptionsGuest': | |
12 // To confirm that the guest view has been successfully created, | |
13 // {pass: true} is added to every extension Window and broadcasts a | |
14 // message to the extension using runtime.sendMessage(). | |
15 chrome.extension.getViews().forEach(function(view) { | |
16 view.pass = true; | |
17 }); | |
18 chrome.runtime.sendMessage('hi'); | |
not at google - send to devlin
2014/07/19 01:37:09
break;
ericzeng
2014/07/19 03:44:25
Done.
| |
19 case 'guestCanAccessStorage': | |
20 // To test access to privileged APIs, the guest attempts to write to local | |
21 // storage, and both the embedder and guest check if the write succeeded. | |
22 var passed = chrome.test.callbackPass; | |
23 | |
24 chrome.test.listenOnce(chrome.storage.onChanged, function(change) { | |
25 chrome.test.assertEq(42, change.test.newValue); | |
26 }); | |
27 | |
28 chrome.storage.local.set({'test': 42}, passed(function() { | |
29 chrome.storage.local.get('test', passed(function(storage) { | |
30 chrome.test.assertEq(42, storage.test); | |
31 })); | |
32 })); | |
33 } | |
34 }); | |
OLD | NEW |