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

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

Issue 2467413002: Fix MediaGalleriesPlatformAppBrowserTest tests with PlzNavigate. (Closed)
Patch Set: a Created 4 years, 1 month 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
« no previous file with comments | « chrome/test/data/extensions/api_test/media_galleries/read_access/test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 check_result_factory(expected) { 5 function check_result_factory(expected) {
6 return function() { 6 return function() {
7 if (expected) { 7 if (expected) {
8 chrome.test.succeed(); 8 chrome.test.succeed();
9 } else { 9 } else {
10 chrome.test.fail(); 10 chrome.test.fail();
11 } 11 }
12 }; 12 };
13 } 13 }
14 14
15 function TestImageLoadFactory(url, should_load) { 15 function TestImageLoadFactory(url, should_load) {
16 return function() { 16 return function() {
17 test_image = document.createElement('img'); 17 test_image = document.createElement('img');
18 document.body.appendChild(test_image); 18 document.body.appendChild(test_image);
19 test_image.addEventListener('load', check_result_factory(should_load)); 19 test_image.addEventListener('load', check_result_factory(should_load));
20 test_image.addEventListener('error', check_result_factory(!should_load)); 20 test_image.addEventListener('error', check_result_factory(!should_load));
21 21
22 test_image.src = url; 22 test_image.src = url;
23 }; 23 };
24 } 24 }
25 25
26 CreateDummyWindowToPreventSleep();
27
28 chrome.test.getConfig(function(config) { 26 chrome.test.getConfig(function(config) {
29 var customArg = JSON.parse(config.customArg); 27 var customArg = JSON.parse(config.customArg);
30 var gallery_id = customArg[0]; 28 var gallery_id = customArg[0];
31 var profile_path = customArg[1]; 29 var profile_path = customArg[1];
32 var extension_url = chrome.runtime.getURL('/'); 30 var extension_url = chrome.runtime.getURL('/');
33 var extension_id = extension_url.split('/')[2]; 31 var extension_id = extension_url.split('/')[2];
34 32
35 var bad_mount_point = 'filesystem:' + extension_url + 33 var bad_mount_point = 'filesystem:' + extension_url +
36 'external/invalid-' + profile_path + '-' + extension_id + '-' + gallery_id + 34 'external/invalid-' + profile_path + '-' + extension_id + '-' + gallery_id +
37 '/test.jpg'; 35 '/test.jpg';
38 36
39 var bad_mount_name = 'filesystem:' + extension_url + 37 var bad_mount_name = 'filesystem:' + extension_url +
40 'external/media_galleries-' + profile_path + '-' + gallery_id + '/test.jpg'; 38 'external/media_galleries-' + profile_path + '-' + gallery_id + '/test.jpg';
41 39
42 var good_url = 'filesystem:' + extension_url + 40 var good_url = 'filesystem:' + extension_url +
43 'external/media_galleries-' + profile_path + '-' + extension_id + '-' + 41 'external/media_galleries-' + profile_path + '-' + extension_id + '-' +
44 gallery_id + '/test.jpg'; 42 gallery_id + '/test.jpg';
45 43
46 chrome.test.runTests([ 44 chrome.test.runTests([
47 TestImageLoadFactory(bad_mount_point, false), 45 TestImageLoadFactory(bad_mount_point, false),
48 TestImageLoadFactory(bad_mount_name, false), 46 TestImageLoadFactory(bad_mount_name, false),
49 TestImageLoadFactory(good_url, true), 47 TestImageLoadFactory(good_url, true),
50 ]); 48 ]);
51 }) 49 })
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/media_galleries/read_access/test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698