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

Unified Diff: net/url_request/url_request_job_unittest.cc

Issue 51953002: [Net] Add a priority parameter to URLRequest's constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error from rebase Created 7 years, 2 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: 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 5f63b0927de2918acbad499ce8d43dc18b849d45..975b92fd70768884b6f76dddd4f63a38118ada80 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -4,66 +4,52 @@
#include "net/url_request/url_request_job.h"
+#include "net/base/request_priority.h"
#include "net/http/http_transaction_unittest.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
// This is a header that signals the end of the data.
const char kGzipGata[] = "\x1f\x08b\x08\0\0\0\0\0\0\3\3\0\0\0\0\0\0\0\0";
-void GZipServer(const net::HttpRequestInfo* request,
- std::string* response_status, std::string* response_headers,
+void GZipServer(const HttpRequestInfo* request,
+ std::string* response_status,
+ std::string* response_headers,
std::string* response_data) {
response_data->assign(kGzipGata, sizeof(kGzipGata));
}
const MockTransaction kGZip_Transaction = {
- "http://www.google.com/gzyp",
- "GET",
- base::Time(),
- "",
- net::LOAD_NORMAL,
- "HTTP/1.1 200 OK",
- "Cache-Control: max-age=10000\n"
- "Content-Encoding: gzip\n"
- "Content-Length: 30\n", // Intentionally wrong.
- base::Time(),
- "",
- TEST_MODE_NORMAL,
- &GZipServer,
- 0,
- net::OK
-};
+ "http://www.google.com/gzyp", "GET", base::Time(), "", LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n"
+ "Content-Encoding: gzip\n"
+ "Content-Length: 30\n", // Intentionally wrong.
+ base::Time(),
+ "", TEST_MODE_NORMAL, &GZipServer, 0, OK};
const MockTransaction kRedirect_Transaction = {
- "http://www.google.com/redirect",
- "GET",
- base::Time(),
- "",
- net::LOAD_NORMAL,
- "HTTP/1.1 302 Found",
- "Cache-Control: max-age=10000\n"
- "Location: http://www.google.com/destination\n"
- "Content-Length: 5\n",
- base::Time(),
- "hello",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.google.com/redirect", "GET", base::Time(), "", LOAD_NORMAL,
+ "HTTP/1.1 302 Found",
+ "Cache-Control: max-age=10000\n"
+ "Location: http://www.google.com/destination\n"
+ "Content-Length: 5\n",
+ base::Time(), "hello", TEST_MODE_NORMAL, NULL, 0, OK};
} // namespace
TEST(URLRequestJob, TransactionNotifiedWhenDone) {
MockNetworkLayer network_layer;
- net::TestURLRequestContext context;
+ TestURLRequestContext context;
context.set_http_transaction_factory(&network_layer);
- net::TestDelegate d;
- net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context, NULL);
+ TestDelegate d;
+ TestURLRequest req(
+ GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, &context, NULL);
AddMockTransaction(&kGZip_Transaction);
req.set_method("GET");
@@ -78,11 +64,12 @@ TEST(URLRequestJob, TransactionNotifiedWhenDone) {
TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) {
MockNetworkLayer network_layer;
- net::TestURLRequestContext context;
+ TestURLRequestContext context;
context.set_http_transaction_factory(&network_layer);
- net::TestDelegate d;
- net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context, NULL);
+ TestDelegate d;
+ TestURLRequest req(
+ GURL(kGZip_Transaction.url), DEFAULT_PRIORITY, &d, &context, NULL);
MockTransaction transaction(kGZip_Transaction);
transaction.test_mode = TEST_MODE_SYNC_ALL;
AddMockTransaction(&transaction);
@@ -99,11 +86,12 @@ TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) {
TEST(URLRequestJob, RedirectTransactionNotifiedWhenDone) {
MockNetworkLayer network_layer;
- net::TestURLRequestContext context;
+ TestURLRequestContext context;
context.set_http_transaction_factory(&network_layer);
- net::TestDelegate d;
- net::TestURLRequest req(GURL(kRedirect_Transaction.url), &d, &context, NULL);
+ TestDelegate d;
+ TestURLRequest req(
+ GURL(kRedirect_Transaction.url), DEFAULT_PRIORITY, &d, &context, NULL);
AddMockTransaction(&kRedirect_Transaction);
req.set_method("GET");
@@ -115,3 +103,5 @@ TEST(URLRequestJob, RedirectTransactionNotifiedWhenDone) {
RemoveMockTransaction(&kRedirect_Transaction);
}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698