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

Unified Diff: net/url_request/url_request_job_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
« no previous file with comments | « net/url_request/url_request_job_factory_impl_unittest.cc ('k') | net/url_request/url_request_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_job_unittest.cc
diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc
index bdce8bdcca9a3f5befd6e81a7e41f2e9c22d3082..6cc5fbc43c2e25534de7dc2bb99e2cd7e2af5b06 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -4,9 +4,11 @@
#include "net/url_request/url_request_job.h"
+#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "net/base/request_priority.h"
#include "net/http/http_transaction_test_util.h"
+#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -78,12 +80,12 @@ TEST(URLRequestJob, TransactionNotifiedWhenDone) {
context.set_http_transaction_factory(&network_layer);
TestDelegate d;
- TestURLRequest req(
- GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, &context);
+ scoped_ptr<URLRequest> req(context.CreateRequest(
+ GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, NULL));
AddMockTransaction(&kGZip_Transaction);
- req.set_method("GET");
- req.Start();
+ req->set_method("GET");
+ req->Start();
base::MessageLoop::current()->Run();
@@ -98,14 +100,14 @@ TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) {
context.set_http_transaction_factory(&network_layer);
TestDelegate d;
- TestURLRequest req(
- GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, &context);
+ scoped_ptr<URLRequest> req(context.CreateRequest(
+ GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, NULL));
MockTransaction transaction(kGZip_Transaction);
transaction.test_mode = TEST_MODE_SYNC_ALL;
AddMockTransaction(&transaction);
- req.set_method("GET");
- req.Start();
+ req->set_method("GET");
+ req->Start();
base::RunLoop().Run();
@@ -121,15 +123,15 @@ TEST(URLRequestJob, SyncSlowTransaction) {
context.set_http_transaction_factory(&network_layer);
TestDelegate d;
- TestURLRequest req(
- GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, &context);
+ scoped_ptr<URLRequest> req(context.CreateRequest(
+ GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, NULL));
MockTransaction transaction(kGZip_Transaction);
transaction.test_mode = TEST_MODE_SYNC_ALL | TEST_MODE_SLOW_READ;
transaction.handler = &BigGZipServer;
AddMockTransaction(&transaction);
- req.set_method("GET");
- req.Start();
+ req->set_method("GET");
+ req->Start();
base::RunLoop().Run();
@@ -144,12 +146,12 @@ TEST(URLRequestJob, RedirectTransactionNotifiedWhenDone) {
context.set_http_transaction_factory(&network_layer);
TestDelegate d;
- TestURLRequest req(
- GURL(kRedirect_Transaction.url), DEFAULT_PRIORITY, &d, &context);
+ scoped_ptr<URLRequest> req(context.CreateRequest(
+ GURL(kRedirect_Transaction.url), DEFAULT_PRIORITY, &d, NULL));
AddMockTransaction(&kRedirect_Transaction);
- req.set_method("GET");
- req.Start();
+ req->set_method("GET");
+ req->Start();
base::RunLoop().Run();
@@ -167,12 +169,12 @@ TEST(URLRequestJob, TransactionNotCachedWhenNetworkDelegateRedirects) {
context.set_network_delegate(&network_delegate);
TestDelegate d;
- TestURLRequest req(GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d,
- &context);
+ scoped_ptr<URLRequest> req(context.CreateRequest(
+ GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, NULL));
AddMockTransaction(&kGZip_Transaction);
- req.set_method("GET");
- req.Start();
+ req->set_method("GET");
+ req->Start();
base::RunLoop().Run();
« no previous file with comments | « net/url_request/url_request_job_factory_impl_unittest.cc ('k') | net/url_request/url_request_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698