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

Unified Diff: content/browser/frame_host/data_url_navigation_browsertest.cc

Issue 2917133002: Perform redirect checks before OnReceivedRedirect in //net. (Closed)
Patch Set: nasko comments Created 3 years, 6 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/frame_host/data_url_navigation_browsertest.cc
diff --git a/content/browser/frame_host/data_url_navigation_browsertest.cc b/content/browser/frame_host/data_url_navigation_browsertest.cc
index 216db80c985bb8138017ecbb04aeb4fcab20c652..2c62b1d5cc7f97e3b96b60fc2403fed8b62eb990 100644
--- a/content/browser/frame_host/data_url_navigation_browsertest.cc
+++ b/content/browser/frame_host/data_url_navigation_browsertest.cc
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/path_service.h"
#include "base/strings/pattern.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
@@ -959,12 +960,18 @@ IN_PROC_BROWSER_TEST_F(DataUrlNavigationBrowserTest,
// The window.open() should have resulted in an error page. The blocked
// URL should be in the virtual URL, not the actual URL.
+ //
+ // TODO(nasko): Now that the error commits on the previous URL, the blocked
+ // navigation logic is no longer needed. https://crbug.com/723796
{
EXPECT_EQ(0, controller->GetLastCommittedEntryIndex());
NavigationEntry* entry = controller->GetLastCommittedEntry();
EXPECT_EQ(PAGE_TYPE_ERROR, entry->GetPageType());
EXPECT_FALSE(entry->GetURL().SchemeIs(url::kDataScheme));
- EXPECT_TRUE(entry->GetVirtualURL().SchemeIs(url::kDataScheme));
+ EXPECT_TRUE(base::StartsWith(
+ entry->GetVirtualURL().spec(),
+ embedded_test_server()->GetURL("/server-redirect?").spec(),
+ base::CompareCase::SENSITIVE));
}
// Navigate forward and then go back to ensure the navigation to data: URL
@@ -981,7 +988,10 @@ IN_PROC_BROWSER_TEST_F(DataUrlNavigationBrowserTest,
NavigationEntry* entry = controller->GetLastCommittedEntry();
EXPECT_EQ(0, controller->GetLastCommittedEntryIndex());
EXPECT_FALSE(entry->GetURL().SchemeIs(url::kDataScheme));
- EXPECT_TRUE(entry->GetVirtualURL().SchemeIs(url::kDataScheme));
+ EXPECT_TRUE(base::StartsWith(
+ entry->GetVirtualURL().spec(),
+ embedded_test_server()->GetURL("/server-redirect?").spec(),
+ base::CompareCase::SENSITIVE));
EXPECT_EQ(url::kAboutBlankURL, entry->GetURL().spec());
}
@@ -998,7 +1008,10 @@ IN_PROC_BROWSER_TEST_F(DataUrlNavigationBrowserTest,
NavigationEntry* entry = controller->GetLastCommittedEntry();
EXPECT_EQ(0, controller->GetLastCommittedEntryIndex());
EXPECT_FALSE(entry->GetURL().SchemeIs(url::kDataScheme));
- EXPECT_TRUE(entry->GetVirtualURL().SchemeIs(url::kDataScheme));
+ EXPECT_TRUE(base::StartsWith(
+ entry->GetVirtualURL().spec(),
+ embedded_test_server()->GetURL("/server-redirect?").spec(),
+ base::CompareCase::SENSITIVE));
EXPECT_EQ(url::kAboutBlankURL, entry->GetURL().spec());
}
}

Powered by Google App Engine
This is Rietveld 408576698