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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 private: | 85 private: |
86 bool complete_; | 86 bool complete_; |
87 std::string data_; | 87 std::string data_; |
88 int total_encoded_data_length_; | 88 int total_encoded_data_length_; |
89 }; | 89 }; |
90 | 90 |
91 | 91 |
92 // Sets up the message sender override for the unit test | 92 // Sets up the message sender override for the unit test |
93 class ResourceDispatcherTest : public testing::Test, | 93 class ResourceDispatcherTest : public testing::Test, public IPC::Sender { |
94 public IPC::Message::Sender { | |
95 public: | 94 public: |
96 // Emulates IPC send operations (IPC::Message::Sender) by adding | 95 // Emulates IPC send operations (IPC::Sender) by adding |
97 // pending messages to the queue. | 96 // pending messages to the queue. |
98 virtual bool Send(IPC::Message* msg) { | 97 virtual bool Send(IPC::Message* msg) { |
99 message_queue_.push_back(IPC::Message(*msg)); | 98 message_queue_.push_back(IPC::Message(*msg)); |
100 delete msg; | 99 delete msg; |
101 return true; | 100 return true; |
102 } | 101 } |
103 | 102 |
104 // Emulates the browser process and processes the pending IPC messages, | 103 // Emulates the browser process and processes the pending IPC messages, |
105 // returning the hardcoded file contents. | 104 // returning the hardcoded file contents. |
106 void ProcessMessages() { | 105 void ProcessMessages() { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 332 |
334 ResourceLoaderBridge* bridge = CreateBridge(); | 333 ResourceLoaderBridge* bridge = CreateBridge(); |
335 | 334 |
336 bridge->Start(this); | 335 bridge->Start(this); |
337 InitMessages(); | 336 InitMessages(); |
338 | 337 |
339 // Dispatch deferred messages. | 338 // Dispatch deferred messages. |
340 message_loop.RunAllPending(); | 339 message_loop.RunAllPending(); |
341 delete bridge; | 340 delete bridge; |
342 } | 341 } |
OLD | NEW |