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

Side by Side Diff: webkit/browser/appcache/appcache_request_handler_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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stack> 5 #include <stack>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/base/request_priority.h"
16 #include "net/http/http_response_headers.h" 17 #include "net/http/http_response_headers.h"
17 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
19 #include "net/url_request/url_request_error_job.h" 20 #include "net/url_request/url_request_error_job.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "webkit/browser/appcache/appcache.h" 22 #include "webkit/browser/appcache/appcache.h"
22 #include "webkit/browser/appcache/appcache_backend_impl.h" 23 #include "webkit/browser/appcache/appcache_backend_impl.h"
23 #include "webkit/browser/appcache/appcache_request_handler.h" 24 #include "webkit/browser/appcache/appcache_request_handler.h"
24 #include "webkit/browser/appcache/appcache_url_request_job.h" 25 #include "webkit/browser/appcache/appcache_url_request_job.h"
25 #include "webkit/browser/appcache/mock_appcache_policy.h" 26 #include "webkit/browser/appcache/mock_appcache_policy.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 111 }
111 112
112 private: 113 private:
113 int response_code_; 114 int response_code_;
114 bool has_response_info_; 115 bool has_response_info_;
115 net::HttpResponseInfo response_info_; 116 net::HttpResponseInfo response_info_;
116 }; 117 };
117 118
118 class MockURLRequest : public net::URLRequest { 119 class MockURLRequest : public net::URLRequest {
119 public: 120 public:
120 MockURLRequest( 121 MockURLRequest(const GURL& url,
121 const GURL& url, 122 net::URLRequestContext* context,
122 net::URLRequestContext* context, 123 net::NetworkDelegate* network_delegate)
123 net::NetworkDelegate* network_delegate) : 124 : net::URLRequest(url,
124 net::URLRequest(url, NULL, context, network_delegate), 125 net::DEFAULT_PRIORITY,
125 network_delegate_(network_delegate) { 126 NULL,
126 } 127 context,
128 network_delegate),
129 network_delegate_(network_delegate) {}
127 130
128 void SimulateResponseCode(int http_response_code) { 131 void SimulateResponseCode(int http_response_code) {
129 mock_factory_job_ = new MockURLRequestJob( 132 mock_factory_job_ = new MockURLRequestJob(
130 this, network_delegate_, http_response_code); 133 this, network_delegate_, http_response_code);
131 Start(); 134 Start();
132 DCHECK(!mock_factory_job_); 135 DCHECK(!mock_factory_job_);
133 // All our simulation needs to satisfy are the following two DCHECKs 136 // All our simulation needs to satisfy are the following two DCHECKs
134 DCHECK(status().is_success()); 137 DCHECK(status().is_success());
135 DCHECK_EQ(http_response_code, GetResponseCode()); 138 DCHECK_EQ(http_response_code, GetResponseCode());
136 } 139 }
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 965
963 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { 966 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) {
964 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); 967 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest);
965 } 968 }
966 969
967 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { 970 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) {
968 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); 971 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked);
969 } 972 }
970 973
971 } // namespace appcache 974 } // namespace appcache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698