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

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc

Issue 10559036: Added URLRequestContext to constructor for URLRequest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with latest version Created 8 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: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc
index 363cc61d43238cb6edcd364312cee9fb9ba2ed5c..305256df899193e6ba6742d142535573ecf37a16 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc
@@ -68,12 +68,14 @@ TEST(WebRequestConditionTest, CreateCondition) {
EXPECT_EQ("", error);
ASSERT_TRUE(result.get());
- TestURLRequest match_request(GURL("http://www.example.com"), NULL);
+ TestURLRequestContext context;
+ TestURLRequest match_request(GURL("http://www.example.com"), NULL, &context);
content::ResourceRequestInfo::AllocateForTesting(&match_request,
ResourceType::MAIN_FRAME, NULL, -1, -1);
EXPECT_TRUE(result->IsFulfilled(&match_request, ON_BEFORE_REQUEST));
- TestURLRequest wrong_resource_type(GURL("https://www.example.com"), NULL);
+ TestURLRequest wrong_resource_type(
+ GURL("https://www.example.com"), NULL, &context);
content::ResourceRequestInfo::AllocateForTesting(&wrong_resource_type,
ResourceType::SUB_FRAME, NULL, -1, -1);
EXPECT_FALSE(result->IsFulfilled(&wrong_resource_type, ON_BEFORE_REQUEST));
@@ -135,7 +137,8 @@ TEST(WebRequestConditionTest, CreateConditionSet) {
// Test that the result is correct and matches http://www.example.com and
// https://www.example.com
GURL http_url("http://www.example.com");
- TestURLRequest http_request(http_url, NULL);
+ TestURLRequestContext context;
+ TestURLRequest http_request(http_url, NULL, &context);
url_match_ids = matcher.MatchURL(http_url);
for (std::set<URLMatcherConditionSet::ID>::iterator i = url_match_ids.begin();
i != url_match_ids.end(); ++i) {
@@ -146,7 +149,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) {
GURL https_url("https://www.example.com");
url_match_ids = matcher.MatchURL(https_url);
- TestURLRequest https_request(https_url, NULL);
+ TestURLRequest https_request(https_url, NULL, &context);
number_matches = 0;
for (std::set<URLMatcherConditionSet::ID>::iterator i = url_match_ids.begin();
i != url_match_ids.end(); ++i) {
@@ -158,7 +161,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) {
// Check that both, hostPrefix and hostSuffix are evaluated.
GURL https_foo_url("https://foo.example.com");
url_match_ids = matcher.MatchURL(https_foo_url);
- TestURLRequest https_foo_request(https_foo_url, NULL);
+ TestURLRequest https_foo_request(https_foo_url, NULL, &context);
number_matches = 0;
for (std::set<URLMatcherConditionSet::ID>::iterator i = url_match_ids.begin();
i != url_match_ids.end(); ++i) {
@@ -213,22 +216,23 @@ TEST(WebRequestConditionTest, TestPortFilter) {
// Test various URLs.
GURL http_url("http://www.example.com");
- TestURLRequest http_request(http_url, NULL);
+ TestURLRequestContext context;
+ TestURLRequest http_request(http_url, NULL, &context);
url_match_ids = matcher.MatchURL(http_url);
ASSERT_EQ(1u, url_match_ids.size());
GURL http_url_80("http://www.example.com:80");
- TestURLRequest http_request_80(http_url_80, NULL);
+ TestURLRequest http_request_80(http_url_80, NULL, &context);
url_match_ids = matcher.MatchURL(http_url_80);
ASSERT_EQ(1u, url_match_ids.size());
GURL http_url_1000("http://www.example.com:1000");
- TestURLRequest http_request_1000(http_url_1000, NULL);
+ TestURLRequest http_request_1000(http_url_1000, NULL, &context);
url_match_ids = matcher.MatchURL(http_url_1000);
ASSERT_EQ(1u, url_match_ids.size());
GURL http_url_2000("http://www.example.com:2000");
- TestURLRequest http_request_2000(http_url_2000, NULL);
+ TestURLRequest http_request_2000(http_url_2000, NULL, &context);
url_match_ids = matcher.MatchURL(http_url_2000);
ASSERT_EQ(0u, url_match_ids.size());
}

Powered by Google App Engine
This is Rietveld 408576698