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

Unified Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 9857009: Consider redirects to about:blank as canceling and don't flag conflicts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 8 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
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
index a004073400f261d47a69436c17a08304ef7b8a8e..0035685a360833d2bbd3431ef66ab3ea379f20b9 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -1142,6 +1142,40 @@ TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses2) {
EXPECT_EQ(3u, event_log.size());
}
+// This tests that we can redirect to about:blank, which is considered
+// a kind of cancelling requests.
+TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses3) {
+ EventResponseDeltas deltas;
+ EventLogEntries event_log;
+ std::set<std::string> conflicting_extensions;
+ GURL effective_new_url;
+
+ // Single redirect.
+ GURL new_url_0("http://foo.com");
+ linked_ptr<EventResponseDelta> d0(
+ new EventResponseDelta("extid0", base::Time::FromInternalValue(2000)));
+ d0->new_url = GURL(new_url_0);
+ deltas.push_back(d0);
+ MergeOnBeforeRequestResponses(
+ deltas, &effective_new_url, &conflicting_extensions, &event_log);
+ EXPECT_EQ(new_url_0, effective_new_url);
+
+ // Cancel request by redirecting to about:blank. This shall override
+ // the other redirect but not cause any conflict warnings.
+ GURL new_url_1("about:blank");
+ linked_ptr<EventResponseDelta> d1(
+ new EventResponseDelta("extid1", base::Time::FromInternalValue(1500)));
+ d1->new_url = GURL(new_url_1);
+ deltas.push_back(d1);
+ deltas.sort(&InDecreasingExtensionInstallationTimeOrder);
+ event_log.clear();
+ MergeOnBeforeRequestResponses(
+ deltas, &effective_new_url, &conflicting_extensions, &event_log);
+ EXPECT_EQ(new_url_1, effective_new_url);
+ EXPECT_TRUE(conflicting_extensions.empty());
+ EXPECT_EQ(1u, event_log.size());
+}
+
TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) {
net::HttpRequestHeaders base_headers;
base_headers.AddHeaderFromString("key1: value 1");
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698