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

Unified Diff: chrome/test/data/extensions/api_test/media_galleries/tourl/test.js

Issue 185393012: Change media galleries to external file system type to add toURL support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/media_galleries/tourl/test.js
diff --git a/chrome/test/data/extensions/api_test/media_galleries/tourl/test.js b/chrome/test/data/extensions/api_test/media_galleries/tourl/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..43baf0f8fd3798b2d37d74035af8f8c8ee16a0ae
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/media_galleries/tourl/test.js
@@ -0,0 +1,51 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function check_result_factory(expected) {
+ return function() {
+ if (expected) {
+ chrome.test.succeed();
+ } else {
+ chrome.test.fail();
+ }
+ };
+}
+
+function TestImageLoadFactory(url, should_load) {
+ return function() {
+ test_image = document.createElement('img');
+ document.body.appendChild(test_image);
+ test_image.addEventListener('load', check_result_factory(should_load));
+ test_image.addEventListener('error', check_result_factory(!should_load));
+
+ test_image.src = url;
+ };
+}
+
+CreateDummyWindowToPreventSleep();
+
+chrome.test.getConfig(function(config) {
+ var customArg = JSON.parse(config.customArg);
+ var gallery_id = customArg[0];
+ var profile_path = customArg[1];
+ var extension_url = chrome.runtime.getURL('/');
+ var extension_id = extension_url.split('/')[2];
+
+ var bad_mount_point = 'filesystem:' + extension_url +
+ 'external/invalid-' + profile_path + '-' + extension_id + '-' + gallery_id +
+ '/test.jpg';
+
+ var bad_mount_name = 'filesystem:' + extension_url +
+ 'external/media_galleries-' + profile_path + '-' + gallery_id + '/test.jpg';
+
+ var good_url = 'filesystem:' + extension_url +
+ 'external/media_galleries-' + profile_path + '-' + extension_id + '-' +
+ gallery_id + '/test.jpg';
+
+ chrome.test.runTests([
+ TestImageLoadFactory(bad_mount_point, false),
+ TestImageLoadFactory(bad_mount_name, false),
+ TestImageLoadFactory(good_url, true),
+ ]);
+})

Powered by Google App Engine
This is Rietveld 408576698