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

Unified Diff: chrome/browser/devtools/devtools_sanity_browsertest.cc

Issue 2453953002: Add test case that navigates to an extension blob from inside of devtools. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_sanity_browsertest.cc
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc
index 2cfc13ac4f7eb5c8008fefb1fdb6fa570294a877..83e7cde8a49ce337659f8854bb02ebc6b7dbf547 100644
--- a/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -1000,12 +1000,13 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest,
dir->WriteFile(FILE_PATH_LITERAL("panel.html"),
"<html><body>A panel."
"<script src='blob_xhr.js'></script>"
+ "<script src='blob_iframe.js'></script>"
"</body></html>");
// Creating blobs from chrome-extension:// origins is only permitted if the
// process has been granted permission to commit 'chrome-extension' schemes.
dir->WriteFile(
FILE_PATH_LITERAL("blob_xhr.js"),
- "var blob_url = URL.createObjectURL(new Blob(['blob contents']));\n"
+ "var blob_url = URL.createObjectURL(new Blob(['xhr blob contents']));\n"
"var xhr = new XMLHttpRequest();\n"
"xhr.open('GET', blob_url, true);\n"
"xhr.onload = function (e) {\n"
@@ -1013,6 +1014,17 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest,
" domAutomationController.send(xhr.response);\n"
"};\n"
"xhr.send(null);\n");
+ dir->WriteFile(
+ FILE_PATH_LITERAL("blob_iframe.js"),
+ "var payload = `"
+ "<html><body>iframe blob contents"
+ "<script>"
+ " domAutomationController.setAutomationId(0);"
+ " domAutomationController.send(document.body.innerText);\n"
+ "</script></body></html>"
+ "`;"
+ "document.body.appendChild(document.createElement('iframe')).src ="
+ " URL.createObjectURL(new Blob([payload], {type: 'text/html'}));");
// Install the extension.
const Extension* extension = LoadExtensionFromPath(dir->UnpackedPath());
ASSERT_TRUE(extension);
@@ -1032,7 +1044,12 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest,
std::string message;
while (true) {
ASSERT_TRUE(message_queue.WaitForMessage(&message));
- if (message == "\"blob contents\"")
+ if (message == "\"xhr blob contents\"")
+ break;
+ }
+ while (true) {
+ ASSERT_TRUE(message_queue.WaitForMessage(&message));
+ if (message == "\"iframe blob contents\"")
break;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698