| OLD | NEW |
| 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 function checkIcon(item, size, path) { | 5 function checkIcon(item, size, path) { |
| 6 var icons = item.icons; | 6 var icons = item.icons; |
| 7 for (var i = 0; i < icons.length; i++) { | 7 for (var i = 0; i < icons.length; i++) { |
| 8 var icon = icons[i]; | 8 var icon = icons[i]; |
| 9 if (icon.size == size) { | 9 if (icon.size == size) { |
| 10 var expected_url = | 10 var expected_url = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 "\"permissions\": [\"http://api.flickr.com/\", " + | 102 "\"permissions\": [\"http://api.flickr.com/\", " + |
| 103 "\"bookmarks\", \"geolocation\", " + | 103 "\"bookmarks\", \"geolocation\", " + |
| 104 "\"history\", \"tabs\"]," + | 104 "\"history\", \"tabs\"]," + |
| 105 "\"content_scripts\": [{\"js\": [\"script.js\"], " + | 105 "\"content_scripts\": [{\"js\": [\"script.js\"], " + |
| 106 "\"matches\": [\"http://*.flickr.com/*\"]}]}"; | 106 "\"matches\": [\"http://*.flickr.com/*\"]}]}"; |
| 107 | 107 |
| 108 chrome.management.getPermissionWarningsByManifest( | 108 chrome.management.getPermissionWarningsByManifest( |
| 109 manifest_str, callback(function(warnings) { | 109 manifest_str, callback(function(warnings) { |
| 110 // Warning for "tabs" is suppressed by "history" permission. | 110 // Warning for "tabs" is suppressed by "history" permission. |
| 111 chrome.test.assertEq(4, warnings.length); | 111 chrome.test.assertEq(4, warnings.length); |
| 112 chrome.test.assertEq( | 112 chrome.test.assertTrue(warnings.indexOf( |
| 113 "Read and change your data on all flickr.com sites and api.flickr.com", | 113 "Read and change your data on all flickr.com sites and api.flickr.com") |
| 114 warnings[0]); | 114 != -1); |
| 115 chrome.test.assertEq("Read and change your bookmarks", warnings[1]); | 115 chrome.test.assertTrue(warnings.indexOf( |
| 116 chrome.test.assertEq("Detect your physical location", warnings[2]); | 116 "Read and change your bookmarks") != -1); |
| 117 chrome.test.assertEq("Read and change your browsing history", | 117 chrome.test.assertTrue(warnings.indexOf( |
| 118 warnings[3]); | 118 "Detect your physical location") != -1); |
| 119 chrome.test.assertTrue( |
| 120 warnings.indexOf("Read and change your browsing history") != -1); |
| 119 })); | 121 })); |
| 120 | 122 |
| 121 chrome.management.getAll(callback(function(items) { | 123 chrome.management.getAll(callback(function(items) { |
| 122 var extension = getItemNamed(items, "Extension Management API Test"); | 124 var extension = getItemNamed(items, "Extension Management API Test"); |
| 123 chrome.management.getPermissionWarningsById(extension.id, | 125 chrome.management.getPermissionWarningsById(extension.id, |
| 124 callback(function(warnings) { | 126 callback(function(warnings) { |
| 125 chrome.test.assertEq(1, warnings.length); | 127 chrome.test.assertEq(1, warnings.length); |
| 126 chrome.test.assertEq("Manage your apps, extensions, and themes", | 128 chrome.test.assertEq("Manage your apps, extensions, and themes", |
| 127 warnings[0]); | 129 warnings[0]); |
| 128 })); | 130 })); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 chrome.management.setEnabled(disabled.id, true, callback(function() { | 170 chrome.management.setEnabled(disabled.id, true, callback(function() { |
| 169 chrome.management.get(disabled.id, callback(function(now_enabled) { | 171 chrome.management.get(disabled.id, callback(function(now_enabled) { |
| 170 checkItem(now_enabled, "disabled_extension", true, "extension"); | 172 checkItem(now_enabled, "disabled_extension", true, "extension"); |
| 171 })); | 173 })); |
| 172 })); | 174 })); |
| 173 })); | 175 })); |
| 174 } | 176 } |
| 175 ]; | 177 ]; |
| 176 | 178 |
| 177 chrome.test.runTests(tests); | 179 chrome.test.runTests(tests); |
| OLD | NEW |