| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/importer/firefox_importer_unittest_utils.h" | 5 #include "chrome/browser/importer/firefox_importer_unittest_utils.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug_on_start.h" | 9 #include "base/debug_on_start.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // Spin until either a client response arrives or a timeout occurs. | 172 // Spin until either a client response arrives or a timeout occurs. |
| 173 bool FFUnitTestDecryptorProxy::WaitForClientResponse() { | 173 bool FFUnitTestDecryptorProxy::WaitForClientResponse() { |
| 174 // What we're trying to do here is to wait for an RPC message to go over the | 174 // What we're trying to do here is to wait for an RPC message to go over the |
| 175 // wire and the client to reply. If the client does not replyy by a given | 175 // wire and the client to reply. If the client does not replyy by a given |
| 176 // timeout we kill the message loop. | 176 // timeout we kill the message loop. |
| 177 // The way we do this is to post a CancellableQuitMsgLoop for 3 seconds in | 177 // The way we do this is to post a CancellableQuitMsgLoop for 3 seconds in |
| 178 // the future and cancel it if an RPC message comes back earlier. | 178 // the future and cancel it if an RPC message comes back earlier. |
| 179 // This relies on the IPC listener class to quit the message loop itself when | 179 // This relies on the IPC listener class to quit the message loop itself when |
| 180 // a message comes in. | 180 // a message comes in. |
| 181 scoped_refptr<CancellableQuitMsgLoop> quit_task = | 181 scoped_refptr<CancellableQuitMsgLoop> quit_task( |
| 182 new CancellableQuitMsgLoop(); | 182 new CancellableQuitMsgLoop()); |
| 183 MessageLoop::current()->PostDelayedTask( | 183 MessageLoop::current()->PostDelayedTask( |
| 184 FROM_HERE, | 184 FROM_HERE, |
| 185 NewRunnableMethod(quit_task.get(), &CancellableQuitMsgLoop::QuitNow), | 185 NewRunnableMethod(quit_task.get(), &CancellableQuitMsgLoop::QuitNow), |
| 186 TestTimeouts::action_max_timeout_ms()); | 186 TestTimeouts::action_max_timeout_ms()); |
| 187 | 187 |
| 188 message_loop_->Run(); | 188 message_loop_->Run(); |
| 189 bool ret = !quit_task->cancelled_; | 189 bool ret = !quit_task->cancelled_; |
| 190 quit_task->cancelled_ = false; | 190 quit_task->cancelled_ = false; |
| 191 return ret; | 191 return ret; |
| 192 } | 192 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener); | 264 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener); |
| 265 CHECK(channel.Connect()); | 265 CHECK(channel.Connect()); |
| 266 listener.SetSender(&channel); | 266 listener.SetSender(&channel); |
| 267 | 267 |
| 268 // run message loop | 268 // run message loop |
| 269 MessageLoop::current()->Run(); | 269 MessageLoop::current()->Run(); |
| 270 | 270 |
| 271 return 0; | 271 return 0; |
| 272 } | 272 } |
| OLD | NEW |