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

Unified Diff: chrome/test/data/extensions/api_test/icons/extension_with_permission/index.js

Issue 10826157: Check for warnings when loading extensions in browser tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ExtensionTerminalPrivateApiTest.TerminalTest Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/icons/extension_with_permission/index.js
diff --git a/chrome/test/data/extensions/api_test/icons/extension_with_permission/index.js b/chrome/test/data/extensions/api_test/icons/extension_with_permission/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..f13ff376403e27a78cefaa46476879586ddc8ff5
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/icons/extension_with_permission/index.js
@@ -0,0 +1,51 @@
+var TEST_CASES = [
+ // Tests loading a standard 128px icon.
+ {
+ url: 'chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/128/0',
+ expectedSize: 128
+ },
+ // Tests loading a standard 48px icon with a MATCH_SMALLER.
+ // This should not be resized to 48px.
+ {
+ url: 'chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/48/2',
+ expectedSize: 32
+ },
+ // Tests loading a standard 32px icon, grayscale. We assume that we actually
+ // got a grayscale image back here.
+ {
+ url: 'chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/' +
+ '32/1?grayscale=true',
+ expectedSize: 32
+ },
+ // Tests loading a 16px by resizing the 32px version (MATCH_BIGGER).
+ // This should be resized to 16px.
+ {
+ url: 'chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/16/1',
+ expectedSize: 16
+ }
+];
+
+var loadedImageCount = 0;
+
+TEST_CASES.forEach(function(testCase) {
+ var img = document.createElement('img');
+ img.onload = function() {
+ if (img.naturalWidth != testCase.expectedSize ||
+ img.naturalHeight != testCase.expectedSize) {
+ document.title = 'Incorrect size on ' + testCase.url +
+ ' Expected: ' + testCase.expectedSize + 'x' + testCase.expectedSize +
+ ' Actual: ' + img.naturalWidth + 'x' + img.naturalHeight;
+ return;
+ }
+
+ if (++loadedImageCount == TEST_CASES.length) {
+ document.title = 'Loaded';
+ }
+ };
+ img.onerror = function() {
+ // We failed to load an image that should have loaded.
+ document.title = 'Couldn\'t load ' + testCase.url;
+ };
+ img.src = testCase.url;
+ document.body.appendChild(img);
+});

Powered by Google App Engine
This is Rietveld 408576698