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

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_loader.js

Issue 485013003: Video Player: Add a test to open a single video file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comments Created 6 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/file_manager_browsertest/gallery/test_loader.js
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_loader.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_loader.js
deleted file mode 100644
index a9bd8345e67ddf9dad5da1c6f555635a7a38107d..0000000000000000000000000000000000000000
--- a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_loader.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// 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.
-
-'use strict';
-
-/**
- * Loads a test script from URL.
- * @param {string} url URL of a script file.
- * @return {Promise} Promise to be fulfilled when completing to load.
- */
-function loadScript(url) {
- return new Promise(function(fulfill, reject) {
- var script = document.createElement('script');
- script.src = url;
- // Ensure the scripts are loaded in the order of calling loadScript.
- script.async = false;
- script.onload = fulfill;
- script.onerror = reject.bind(null, 'Faile to load ' + url);
- document.documentElement.appendChild(script);
- });
-}
-
-var testUtilPromise = loadScript(
- 'chrome-extension:///ejhcmmdhhpdhhgmifplfmjobgegbibkn/test_util.js');
-
-testUtilPromise.then(function() {
- var inGuestModePromise = sendTestMessage({name: 'isInGuestMode'});
- var testNamePromise = sendTestMessage({name: 'getTestName'});
- var scriptsPromise = sendTestMessage({name: 'getScripts'});
- Promise.all([inGuestModePromise, testNamePromise, scriptsPromise]).then(
- function(args) {
- // Do nothing if the guest mode is different.
- if (JSON.parse(args[0]) !== chrome.extension.inIncognitoContext)
- return;
- var scripts = JSON.parse(args[2]);
- return Promise.all(scripts.map(loadScript)).then(function() {
- var testName = args[1];
- var testCase = function() {
- var success = chrome.test.callbackPass();
- Promise.resolve().then(function() {
- return window[testName]();
- }).then(function() {
- success();
- }, function(error) {
- chrome.test.fail(error.stack || error);
- });
- };
- testCase.generatedName = testName;
- chrome.test.runTests([testCase]);
- });
- });
-}).catch(function(error) {
- chrome.test.fail(error.stack || error);
-});

Powered by Google App Engine
This is Rietveld 408576698