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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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.h" 8 #include "base/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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 private: 115 private:
116 virtual ~FakeResourceMessageFilter() {} 116 virtual ~FakeResourceMessageFilter() {}
117 117
118 FakeResourceContext context_; 118 FakeResourceContext context_;
119 }; 119 };
120 120
121 class ResourceSchedulerTest : public testing::Test { 121 class ResourceSchedulerTest : public testing::Test {
122 protected: 122 protected:
123 ResourceSchedulerTest() 123 ResourceSchedulerTest()
124 : next_request_id_(0), 124 : next_request_id_(0),
125 message_loop_(MessageLoop::TYPE_IO), 125 message_loop_(base::MessageLoop::TYPE_IO),
126 ui_thread_(BrowserThread::UI, &message_loop_), 126 ui_thread_(BrowserThread::UI, &message_loop_),
127 io_thread_(BrowserThread::IO, &message_loop_) { 127 io_thread_(BrowserThread::IO, &message_loop_) {
128 scheduler_.OnClientCreated(kChildId, kRouteId); 128 scheduler_.OnClientCreated(kChildId, kRouteId);
129 context_.set_http_server_properties(&http_server_properties_); 129 context_.set_http_server_properties(&http_server_properties_);
130 } 130 }
131 131
132 virtual ~ResourceSchedulerTest() { 132 virtual ~ResourceSchedulerTest() {
133 scheduler_.OnClientDeleted(kChildId, kRouteId); 133 scheduler_.OnClientDeleted(kChildId, kRouteId);
134 } 134 }
135 135
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 request->url_request()); 192 request->url_request());
193 const GlobalRequestID& id = info->GetGlobalRequestID(); 193 const GlobalRequestID& id = info->GetGlobalRequestID();
194 ResourceHostMsg_DidChangePriority msg( 194 ResourceHostMsg_DidChangePriority msg(
195 kRouteId, id.request_id, new_priority); 195 kRouteId, id.request_id, new_priority);
196 bool ok = false; 196 bool ok = false;
197 rdh_.OnMessageReceived(msg, filter.get(), &ok); 197 rdh_.OnMessageReceived(msg, filter.get(), &ok);
198 EXPECT_TRUE(ok); 198 EXPECT_TRUE(ok);
199 } 199 }
200 200
201 int next_request_id_; 201 int next_request_id_;
202 MessageLoop message_loop_; 202 base::MessageLoop message_loop_;
203 BrowserThreadImpl ui_thread_; 203 BrowserThreadImpl ui_thread_;
204 BrowserThreadImpl io_thread_; 204 BrowserThreadImpl io_thread_;
205 ResourceDispatcherHostImpl rdh_; 205 ResourceDispatcherHostImpl rdh_;
206 ResourceScheduler scheduler_; 206 ResourceScheduler scheduler_;
207 net::HttpServerPropertiesImpl http_server_properties_; 207 net::HttpServerPropertiesImpl http_server_properties_;
208 net::TestURLRequestContext context_; 208 net::TestURLRequestContext context_;
209 }; 209 };
210 210
211 TEST_F(ResourceSchedulerTest, OneIsolatedLowRequest) { 211 TEST_F(ResourceSchedulerTest, OneIsolatedLowRequest) {
212 scoped_ptr<TestRequest> request(NewRequest("http://host/1", net::LOWEST)); 212 scoped_ptr<TestRequest> request(NewRequest("http://host/1", net::LOWEST));
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 EXPECT_FALSE(idle->started()); 408 EXPECT_FALSE(idle->started());
409 409
410 scheduler_.OnWillInsertBody(kChildId, kRouteId); 410 scheduler_.OnWillInsertBody(kChildId, kRouteId);
411 EXPECT_FALSE(request->started()); 411 EXPECT_FALSE(request->started());
412 EXPECT_FALSE(idle->started()); 412 EXPECT_FALSE(idle->started());
413 } 413 }
414 414
415 } // unnamed namespace 415 } // unnamed namespace
416 416
417 } // namespace content 417 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader_unittest.cc ('k') | content/browser/media/media_internals_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698