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

Unified Diff: chrome/browser/net/chrome_network_delegate_unittest.cc

Issue 501163002: Make URLRequest's constructor private, and make URLRequestContext a friend class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge yet again Created 6 years, 3 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/net/chrome_network_delegate_unittest.cc
diff --git a/chrome/browser/net/chrome_network_delegate_unittest.cc b/chrome/browser/net/chrome_network_delegate_unittest.cc
index 303a57e9246a998779467c379ec6bcf612ee9196..bfec3613dec7b38d282f51903600477f83f5c8fa 100644
--- a/chrome/browser/net/chrome_network_delegate_unittest.cc
+++ b/chrome/browser/net/chrome_network_delegate_unittest.cc
@@ -52,22 +52,22 @@ class ChromeNetworkDelegateTest : public testing::Test {
scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate());
net::TestURLRequestContext context;
- net::TestURLRequest extension_request(
- GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL, &context);
- extension_request.set_first_party_for_cookies(
+ scoped_ptr<net::URLRequest> extension_request(context.CreateRequest(
+ GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL, NULL));
+ extension_request->set_first_party_for_cookies(
GURL("chrome-extension://abcdef/bingo.html"));
- net::TestURLRequest web_page_request(
- GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL, &context);
- web_page_request.set_first_party_for_cookies(
+ scoped_ptr<net::URLRequest> web_page_request(context.CreateRequest(
+ GURL("http://example.com/"), net::DEFAULT_PRIORITY, NULL, NULL));
+ web_page_request->set_first_party_for_cookies(
GURL("http://example.com/helloworld.html"));
- ASSERT_TRUE(delegate->OnCanThrottleRequest(extension_request));
- ASSERT_FALSE(delegate->OnCanThrottleRequest(web_page_request));
+ ASSERT_TRUE(delegate->OnCanThrottleRequest(*extension_request));
+ ASSERT_FALSE(delegate->OnCanThrottleRequest(*web_page_request));
delegate->NeverThrottleRequests();
ASSERT_TRUE(ChromeNetworkDelegate::g_never_throttle_requests_);
- ASSERT_FALSE(delegate->OnCanThrottleRequest(extension_request));
- ASSERT_FALSE(delegate->OnCanThrottleRequest(web_page_request));
+ ASSERT_FALSE(delegate->OnCanThrottleRequest(*extension_request));
+ ASSERT_FALSE(delegate->OnCanThrottleRequest(*web_page_request));
// Verify that the flag applies to later instances of the
// ChromeNetworkDelegate.
@@ -77,8 +77,8 @@ class ChromeNetworkDelegateTest : public testing::Test {
// implementation would show the same behavior, i.e. all instances
// of ChromeNetworkDelegate after the flag is set obey the flag.
scoped_ptr<ChromeNetworkDelegate> second_delegate(CreateNetworkDelegate());
- ASSERT_FALSE(delegate->OnCanThrottleRequest(extension_request));
- ASSERT_FALSE(delegate->OnCanThrottleRequest(web_page_request));
+ ASSERT_FALSE(delegate->OnCanThrottleRequest(*extension_request));
+ ASSERT_FALSE(delegate->OnCanThrottleRequest(*web_page_request));
}
private:
@@ -134,13 +134,13 @@ class ChromeNetworkDelegateSafeSearchTest : public testing::Test {
// Show the URL in the trace so we know where we failed.
SCOPED_TRACE(url_string);
- net::TestURLRequest request(
- GURL(url_string), net::DEFAULT_PRIORITY, &delegate_, &context_);
+ scoped_ptr<net::URLRequest> request(context_.CreateRequest(
+ GURL(url_string), net::DEFAULT_PRIORITY, &delegate_, NULL));
- request.Start();
+ request->Start();
base::MessageLoop::current()->RunUntilIdle();
- EXPECT_EQ(expected_query_parameters, request.url().query());
+ EXPECT_EQ(expected_query_parameters, request->url().query());
}
private:

Powered by Google App Engine
This is Rietveld 408576698