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

Unified Diff: content/browser/bookmarklet_browsertest.cc

Issue 2795903002: Prevent bookmarklet and unload tests from being broken by data URL deprecation. (Closed)
Patch Set: Convert std::string to char* Created 3 years, 9 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: content/browser/bookmarklet_browsertest.cc
diff --git a/content/browser/bookmarklet_browsertest.cc b/content/browser/bookmarklet_browsertest.cc
index b4ae75ab4d2243544a2146f21b833a1ec18b38df..14d135cda15afe1a1456dcc5e7cecc140f8bb745 100644
--- a/content/browser/bookmarklet_browsertest.cc
+++ b/content/browser/bookmarklet_browsertest.cc
@@ -14,7 +14,11 @@
namespace content {
class BookmarkletTest : public ContentBrowserTest {
- public:
+ protected:
+ void SetUpOnMainThread() override {
+ ASSERT_TRUE(embedded_test_server()->Start());
+ }
+
void NavigateToStartPage() {
NavigateToURL(shell(), GURL("data:text/html,start page"));
EXPECT_EQ("start page", GetBodyText());
@@ -33,9 +37,11 @@ class BookmarkletTest : public ContentBrowserTest {
IN_PROC_BROWSER_TEST_F(BookmarkletTest, Redirect) {
NavigateToStartPage();
- NavigateToURL(shell(), GURL(
- "javascript:location.href='data:text/plain,SUCCESS'"));
- EXPECT_EQ("SUCCESS", GetBodyText());
+ const GURL url(base::StringPrintf(
+ "javascript:location.href='%s'",
+ embedded_test_server()->GetURL("/simple_page.html").spec().c_str()));
+ NavigateToURL(shell(), url);
+ EXPECT_EQ("Basic html test.", GetBodyText());
}
IN_PROC_BROWSER_TEST_F(BookmarkletTest, RedirectVoided) {
@@ -45,9 +51,11 @@ IN_PROC_BROWSER_TEST_F(BookmarkletTest, RedirectVoided) {
// here is to emphasize that in either case the assignment to location during
// the evaluation of the script should suppress loading the script result.
// Here, because of the void() wrapping there is no script result.
- NavigateToURL(shell(), GURL(
- "javascript:void(location.href='data:text/plain,SUCCESS')"));
- EXPECT_EQ("SUCCESS", GetBodyText());
+ const GURL url(base::StringPrintf(
+ "javascript:void(location.href='%s')",
+ embedded_test_server()->GetURL("/simple_page.html").spec().c_str()));
+ NavigateToURL(shell(), url);
+ EXPECT_EQ("Basic html test.", GetBodyText());
}
// http://crbug.com/177957
« chrome/browser/unload_browsertest.cc ('K') | « chrome/browser/unload_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698