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

Side by Side Diff: content/browser/loader/resource_scheduler_unittest.cc

Issue 136683004: Removes MessageLoop::TYPE_XXX where possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolve merge Created 6 years, 11 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 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 "content/browser/loader/resource_scheduler.h" 5 #include "content/browser/loader/resource_scheduler.h"
6 6
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "content/browser/browser_thread_impl.h" 10 #include "content/browser/browser_thread_impl.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 *request_context = NULL; 118 *request_context = NULL;
119 } 119 }
120 120
121 FakeResourceContext context_; 121 FakeResourceContext context_;
122 }; 122 };
123 123
124 class ResourceSchedulerTest : public testing::Test { 124 class ResourceSchedulerTest : public testing::Test {
125 protected: 125 protected:
126 ResourceSchedulerTest() 126 ResourceSchedulerTest()
127 : next_request_id_(0), 127 : next_request_id_(0),
128 message_loop_(base::MessageLoop::TYPE_IO),
129 ui_thread_(BrowserThread::UI, &message_loop_), 128 ui_thread_(BrowserThread::UI, &message_loop_),
130 io_thread_(BrowserThread::IO, &message_loop_) { 129 io_thread_(BrowserThread::IO, &message_loop_) {
131 scheduler_.OnClientCreated(kChildId, kRouteId); 130 scheduler_.OnClientCreated(kChildId, kRouteId);
132 context_.set_http_server_properties(http_server_properties_.GetWeakPtr()); 131 context_.set_http_server_properties(http_server_properties_.GetWeakPtr());
133 } 132 }
134 133
135 virtual ~ResourceSchedulerTest() { 134 virtual ~ResourceSchedulerTest() {
136 scheduler_.OnClientDeleted(kChildId, kRouteId); 135 scheduler_.OnClientDeleted(kChildId, kRouteId);
137 } 136 }
138 137
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 const ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest( 195 const ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(
197 request->url_request()); 196 request->url_request());
198 const GlobalRequestID& id = info->GetGlobalRequestID(); 197 const GlobalRequestID& id = info->GetGlobalRequestID();
199 ResourceHostMsg_DidChangePriority msg(id.request_id, new_priority); 198 ResourceHostMsg_DidChangePriority msg(id.request_id, new_priority);
200 bool ok = false; 199 bool ok = false;
201 rdh_.OnMessageReceived(msg, filter.get(), &ok); 200 rdh_.OnMessageReceived(msg, filter.get(), &ok);
202 EXPECT_TRUE(ok); 201 EXPECT_TRUE(ok);
203 } 202 }
204 203
205 int next_request_id_; 204 int next_request_id_;
206 base::MessageLoop message_loop_; 205 base::MessageLoopForIO message_loop_;
207 BrowserThreadImpl ui_thread_; 206 BrowserThreadImpl ui_thread_;
208 BrowserThreadImpl io_thread_; 207 BrowserThreadImpl io_thread_;
209 ResourceDispatcherHostImpl rdh_; 208 ResourceDispatcherHostImpl rdh_;
210 ResourceScheduler scheduler_; 209 ResourceScheduler scheduler_;
211 net::HttpServerPropertiesImpl http_server_properties_; 210 net::HttpServerPropertiesImpl http_server_properties_;
212 net::TestURLRequestContext context_; 211 net::TestURLRequestContext context_;
213 }; 212 };
214 213
215 TEST_F(ResourceSchedulerTest, OneIsolatedLowRequest) { 214 TEST_F(ResourceSchedulerTest, OneIsolatedLowRequest) {
216 scoped_ptr<TestRequest> request(NewRequest("http://host/1", net::LOWEST)); 215 scoped_ptr<TestRequest> request(NewRequest("http://host/1", net::LOWEST));
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 scheduler_.OnReceivedSpdyProxiedHttpResponse(kChildId, kRouteId); 474 scheduler_.OnReceivedSpdyProxiedHttpResponse(kChildId, kRouteId);
476 EXPECT_TRUE(request->started()); 475 EXPECT_TRUE(request->started());
477 476
478 scoped_ptr<TestRequest> after(NewRequest("http://host/after", net::IDLE)); 477 scoped_ptr<TestRequest> after(NewRequest("http://host/after", net::IDLE));
479 EXPECT_TRUE(after->started()); 478 EXPECT_TRUE(after->started());
480 } 479 }
481 480
482 } // unnamed namespace 481 } // unnamed namespace
483 482
484 } // namespace content 483 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698