| OLD | NEW |
| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return NewRequestWithRoute(url, priority, kRouteId); | 186 return NewRequestWithRoute(url, priority, kRouteId); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void ChangeRequestPriority(TestRequest* request, | 189 void ChangeRequestPriority(TestRequest* request, |
| 190 net::RequestPriority new_priority) { | 190 net::RequestPriority new_priority) { |
| 191 scoped_refptr<FakeResourceMessageFilter> filter( | 191 scoped_refptr<FakeResourceMessageFilter> filter( |
| 192 new FakeResourceMessageFilter(kChildId)); | 192 new FakeResourceMessageFilter(kChildId)); |
| 193 const ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest( | 193 const ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest( |
| 194 request->url_request()); | 194 request->url_request()); |
| 195 const GlobalRequestID& id = info->GetGlobalRequestID(); | 195 const GlobalRequestID& id = info->GetGlobalRequestID(); |
| 196 ResourceHostMsg_DidChangePriority msg( | 196 ResourceHostMsg_DidChangePriority msg(id.request_id, new_priority); |
| 197 kRouteId, id.request_id, new_priority); | |
| 198 bool ok = false; | 197 bool ok = false; |
| 199 rdh_.OnMessageReceived(msg, filter.get(), &ok); | 198 rdh_.OnMessageReceived(msg, filter.get(), &ok); |
| 200 EXPECT_TRUE(ok); | 199 EXPECT_TRUE(ok); |
| 201 } | 200 } |
| 202 | 201 |
| 203 int next_request_id_; | 202 int next_request_id_; |
| 204 base::MessageLoop message_loop_; | 203 base::MessageLoop message_loop_; |
| 205 BrowserThreadImpl ui_thread_; | 204 BrowserThreadImpl ui_thread_; |
| 206 BrowserThreadImpl io_thread_; | 205 BrowserThreadImpl io_thread_; |
| 207 ResourceDispatcherHostImpl rdh_; | 206 ResourceDispatcherHostImpl rdh_; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 EXPECT_FALSE(idle->started()); | 426 EXPECT_FALSE(idle->started()); |
| 428 | 427 |
| 429 scheduler_.OnWillInsertBody(kChildId, kRouteId); | 428 scheduler_.OnWillInsertBody(kChildId, kRouteId); |
| 430 EXPECT_FALSE(request->started()); | 429 EXPECT_FALSE(request->started()); |
| 431 EXPECT_FALSE(idle->started()); | 430 EXPECT_FALSE(idle->started()); |
| 432 } | 431 } |
| 433 | 432 |
| 434 } // unnamed namespace | 433 } // unnamed namespace |
| 435 | 434 |
| 436 } // namespace content | 435 } // namespace content |
| OLD | NEW |