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

Unified Diff: chrome/test/data/extensions/api_test/automation/tests/desktop/common.js

Issue 667713006: Implement automatic load of composed/embedded automation trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Fix UAF Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/automation/tests/desktop/common.js
diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js
index 61d5a6b42e17d866564c1e93659ebab7c7558897..65c79d6a7165f155ec5c9fa30f0c4d39cc400673 100644
--- a/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js
+++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js
@@ -25,9 +25,31 @@ function findAutomationNode(root, condition) {
return null;
}
-function setupAndRunTests(allTests) {
- chrome.automation.getDesktop(function(rootNodeArg) {
- rootNode = rootNodeArg;
- chrome.test.runTests(allTests);
+function runWithDocument(docString, callback) {
+ var url = 'data:text/html,<!doctype html>' + docString;
+ var createParams = {
+ active: true,
+ url: url
+ };
+ chrome.tabs.create(createParams, function(tab) {
+ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) {
+ if (tabId == tab.id && changeInfo.status == 'complete') {
+ callback();
+ }
+ });
});
}
+
+function setupAndRunTests(allTests, opt_docString) {
+ function runTestInternal() {
+ chrome.automation.getDesktop(function(rootNodeArg) {
+ rootNode = rootNodeArg;
+ chrome.test.runTests(allTests);
+ });
+ }
+
+ if (opt_docString)
+ runWithDocument(opt_docString, runTestInternal);
+ else
+ runTestInternal();
+}

Powered by Google App Engine
This is Rietveld 408576698