Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/test/data/extensions/api_test/developer/test/basics.js

Issue 997183005: [Extensions] Add a developerPrivate.updateExtensionConfiguration function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 var tests = [ 5 var tests = [
6 function simple() { 6 function simple() {
7 chrome.developerPrivate.getItemsInfo(true, // include disabled 7 chrome.developerPrivate.getItemsInfo(true, // include disabled
8 true, // include terminated 8 true, // include terminated
9 callback(function(items) { 9 callback(function(items) {
10 chrome.test.assertEq(3, items.length); 10 chrome.test.assertEq(3, items.length);
11 11
12 checkItemInList(items, "hosted_app", true, "hosted_app", 12 checkItemInList(items, "hosted_app", true, "hosted_app",
13 { "app_launch_url": "http://www.google.com/", 13 { "app_launch_url": "http://www.google.com/",
14 "offline_enabled": true, 14 "offline_enabled": true,
15 "update_url": "http://example.com/update.xml" }); 15 "update_url": "http://example.com/update.xml" });
16 16
17 checkItemInList(items, "simple_extension", true, "extension", 17 checkItemInList(items, "simple_extension", true, "extension",
18 { "homepage_url": "http://example.com/", 18 { "homepage_url": "http://example.com/",
19 "options_url": "chrome-extension://<ID>/pages/options.html"}); 19 "options_url": "chrome-extension://<ID>/pages/options.html"});
20 20
21 var extension = getItemNamed(items, "packaged_app"); 21 var extension = getItemNamed(items, "packaged_app");
22 checkItemInList(items, "packaged_app", true, "packaged_app", 22 checkItemInList(items, "packaged_app", true, "packaged_app",
23 { "offline_enabled": true}); 23 { "offline_enabled": true});
24 })); 24 }));
25 },
26 function aliasedFunctions() {
27 // The allow file access and allow incognito functions are aliased with
28 // custom bindings. Test that they work as expected.
29 var getExtensionInfoCallback = chrome.test.callbackAdded();
30 chrome.developerPrivate.getExtensionsInfo(function(infos) {
31 var info = null;
32 for (var i = 0; i < infos.length; ++i) {
33 if (infos[i].name == 'simple_extension') {
34 info = infos[i];
35 break;
36 }
37 }
38 var extId = info.id;
39 chrome.test.assertTrue(info != null);
Dan Beam 2015/03/18 19:12:49 ^ shouldn't you do this before accessing info.id?
Devlin 2015/03/18 22:20:28 Yes. Done.
40 chrome.test.assertFalse(info.incognitoAccess.isActive);
41 chrome.test.assertTrue(info.fileAccess.isActive);
42 chrome.test.assertEq(chrome.developerPrivate.ExtensionState.ENABLED,
43 info.state);
44 var allowIncognitoCallback = chrome.test.callbackAdded();
45 chrome.test.runWithUserGesture(function() {
46 chrome.developerPrivate.allowIncognito(extId, true, function() {
47 chrome.developerPrivate.getExtensionInfo(extId, function(info) {
48 chrome.test.assertTrue(info.incognitoAccess.isActive);
49 allowIncognitoCallback();
50 });
51 });
52 });
53 var allowFileAccessCallback = chrome.test.callbackAdded();
54 chrome.test.runWithUserGesture(function() {
55 chrome.developerPrivate.allowFileAccess(extId, false, function() {
56 chrome.developerPrivate.getExtensionInfo(extId, function(info) {
57 chrome.test.assertFalse(info.fileAccess.isActive);
58 allowFileAccessCallback();
59 });
60 });
61 });
62
63 getExtensionInfoCallback();
Dan Beam 2015/03/18 19:12:49 nit: Promises?
Devlin 2015/03/18 22:20:28 I've tried rewriting it a few ways, and, frankly,
Dan Beam 2015/03/18 22:38:13 don't worry about it
64 });
25 } 65 }
26 ]; 66 ];
27 67
28 chrome.test.runTests(tests); 68 chrome.test.runTests(tests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698