| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process.h" | 9 #include "base/process.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void OnDownloadedData(int len) { | 59 virtual void OnDownloadedData(int len) { |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void OnReceivedData(const char* data, int len) { | 62 virtual void OnReceivedData(const char* data, int len) { |
| 63 EXPECT_FALSE(complete_); | 63 EXPECT_FALSE(complete_); |
| 64 data_.append(data, len); | 64 data_.append(data, len); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void OnCompletedRequest(const URLRequestStatus& status, | 67 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 68 const std::string& security_info, | 68 const std::string& security_info, |
| 69 const base::Time& completion_time) { | 69 const base::Time& completion_time) { |
| 70 EXPECT_FALSE(complete_); | 70 EXPECT_FALSE(complete_); |
| 71 complete_ = true; | 71 complete_ = true; |
| 72 } | 72 } |
| 73 | 73 |
| 74 const std::string& data() const { | 74 const std::string& data() const { |
| 75 return data_; | 75 return data_; |
| 76 } | 76 } |
| 77 bool complete() const { | 77 bool complete() const { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 virtual bool Send(IPC::Message* msg) { | 225 virtual bool Send(IPC::Message* msg) { |
| 226 delete msg; | 226 delete msg; |
| 227 return true; | 227 return true; |
| 228 } | 228 } |
| 229 | 229 |
| 230 void InitMessages() { | 230 void InitMessages() { |
| 231 set_defer_loading(true); | 231 set_defer_loading(true); |
| 232 | 232 |
| 233 ResourceResponseHead response_head; | 233 ResourceResponseHead response_head; |
| 234 response_head.status.set_status(URLRequestStatus::SUCCESS); | 234 response_head.status.set_status(net::URLRequestStatus::SUCCESS); |
| 235 | 235 |
| 236 IPC::Message* response_message = | 236 IPC::Message* response_message = |
| 237 new ViewMsg_Resource_ReceivedResponse(0, 0, response_head); | 237 new ViewMsg_Resource_ReceivedResponse(0, 0, response_head); |
| 238 | 238 |
| 239 dispatcher_->OnMessageReceived(*response_message); | 239 dispatcher_->OnMessageReceived(*response_message); |
| 240 | 240 |
| 241 delete response_message; | 241 delete response_message; |
| 242 | 242 |
| 243 // Duplicate the shared memory handle so both the test and the callee can | 243 // Duplicate the shared memory handle so both the test and the callee can |
| 244 // close their copy. | 244 // close their copy. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 virtual void OnDownloadedData(int len) { | 279 virtual void OnDownloadedData(int len) { |
| 280 } | 280 } |
| 281 | 281 |
| 282 virtual void OnReceivedData(const char* data, int len) { | 282 virtual void OnReceivedData(const char* data, int len) { |
| 283 EXPECT_EQ(defer_loading_, false); | 283 EXPECT_EQ(defer_loading_, false); |
| 284 set_defer_loading(false); | 284 set_defer_loading(false); |
| 285 } | 285 } |
| 286 | 286 |
| 287 virtual void OnCompletedRequest(const URLRequestStatus& status, | 287 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 288 const std::string& security_info, | 288 const std::string& security_info, |
| 289 const base::Time& completion_time) { | 289 const base::Time& completion_time) { |
| 290 } | 290 } |
| 291 | 291 |
| 292 protected: | 292 protected: |
| 293 virtual void SetUp() { | 293 virtual void SetUp() { |
| 294 ResourceDispatcherTest::SetUp(); | 294 ResourceDispatcherTest::SetUp(); |
| 295 shared_handle_.Delete(kShmemSegmentName); | 295 shared_handle_.Delete(kShmemSegmentName); |
| 296 EXPECT_EQ(true, shared_handle_.CreateNamed(kShmemSegmentName, false, 100)); | 296 EXPECT_EQ(true, shared_handle_.CreateNamed(kShmemSegmentName, false, 100)); |
| 297 } | 297 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 321 | 321 |
| 322 ResourceLoaderBridge* bridge = CreateBridge(); | 322 ResourceLoaderBridge* bridge = CreateBridge(); |
| 323 | 323 |
| 324 bridge->Start(this); | 324 bridge->Start(this); |
| 325 InitMessages(); | 325 InitMessages(); |
| 326 | 326 |
| 327 // Dispatch deferred messages. | 327 // Dispatch deferred messages. |
| 328 message_loop.RunAllPending(); | 328 message_loop.RunAllPending(); |
| 329 delete bridge; | 329 delete bridge; |
| 330 } | 330 } |
| OLD | NEW |