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.
5 function check_result_factory(expected) {
15 function TestImageLoadFactory(url, should_load) {
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));
26 CreateDummyWindowToPreventSleep();
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];
35 var bad_mount_point = 'filesystem:' + extension_url +
36 'external/invalid-' + profile_path + '-' + extension_id + '-' + gallery_id +
39 var bad_mount_name = 'filesystem:' + extension_url +
40 'external/media_galleries-' + profile_path + '-' + gallery_id + '/test.jpg';
42 var good_url = 'filesystem:' + extension_url +
43 'external/media_galleries-' + profile_path + '-' + extension_id + '-' +
44 gallery_id + '/test.jpg';
46 chrome.test.runTests([
47 TestImageLoadFactory(bad_mount_point, false),
48 TestImageLoadFactory(bad_mount_name, false),
49 TestImageLoadFactory(good_url, true),