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

Side by Side 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, 8 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 | Annotate | Revision Log
OLDNEW
(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 function check_result_factory(expected) {
6 return function() {
7 if (expected) {
8 chrome.test.succeed();
9 } else {
10 chrome.test.fail();
11 }
12 };
13 }
14
15 function TestImageLoadFactory(url, should_load) {
16 return function() {
17 test_image = document.createElement('img');
18 document.body.appendChild(test_image);
19 test_image.addEventListener('load', check_result_factory(should_load));
20 test_image.addEventListener('error', check_result_factory(!should_load));
21
22 test_image.src = url;
23 };
24 }
25
26 CreateDummyWindowToPreventSleep();
27
28 chrome.test.getConfig(function(config) {
29 var customArg = JSON.parse(config.customArg);
30 var gallery_id = customArg[0];
31 var profile_path = customArg[1];
32 var extension_url = chrome.runtime.getURL('/');
33 var extension_id = extension_url.split('/')[2];
34
35 var bad_mount_point = 'filesystem:' + extension_url +
36 'external/invalid-' + profile_path + '-' + extension_id + '-' + gallery_id +
37 '/test.jpg';
38
39 var bad_mount_name = 'filesystem:' + extension_url +
40 'external/media_galleries-' + profile_path + '-' + gallery_id + '/test.jpg';
41
42 var good_url = 'filesystem:' + extension_url +
43 'external/media_galleries-' + profile_path + '-' + extension_id + '-' +
44 gallery_id + '/test.jpg';
45
46 chrome.test.runTests([
47 TestImageLoadFactory(bad_mount_point, false),
48 TestImageLoadFactory(bad_mount_name, false),
49 TestImageLoadFactory(good_url, true),
50 ]);
51 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698