| 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 "chrome/utility/importer/firefox_importer_unittest_utils.h" | 5 #include "chrome/utility/importer/firefox_importer_unittest_utils.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() { | 132 FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() { |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) { | 135 bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) { |
| 136 // Create a new message loop and spawn the child process. | 136 // Create a new message loop and spawn the child process. |
| 137 message_loop_.reset(new base::MessageLoopForIO()); | 137 message_loop_.reset(new base::MessageLoopForIO()); |
| 138 | 138 |
| 139 listener_.reset(new FFDecryptorServerChannelListener()); | 139 listener_.reset(new FFDecryptorServerChannelListener()); |
| 140 channel_ = IPC::Channel::CreateServer(kTestChannelID, listener_.get()); | 140 channel_ = |
| 141 IPC::Channel::CreateServer(kTestChannelID, listener_.get(), nullptr); |
| 141 CHECK(channel_->Connect()); | 142 CHECK(channel_->Connect()); |
| 142 listener_->SetSender(channel_.get()); | 143 listener_->SetSender(channel_.get()); |
| 143 | 144 |
| 144 // Spawn child and set up sync IPC connection. | 145 // Spawn child and set up sync IPC connection. |
| 145 child_process_ = LaunchNSSDecrypterChildProcess(nss_path, channel_.get()); | 146 child_process_ = LaunchNSSDecrypterChildProcess(nss_path, channel_.get()); |
| 146 return child_process_.IsValid(); | 147 return child_process_.IsValid(); |
| 147 } | 148 } |
| 148 | 149 |
| 149 FFUnitTestDecryptorProxy::~FFUnitTestDecryptorProxy() { | 150 FFUnitTestDecryptorProxy::~FFUnitTestDecryptorProxy() { |
| 150 listener_->QuitClient(); | 151 listener_->QuitClient(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 private: | 278 private: |
| 278 NSSDecryptor decryptor_; | 279 NSSDecryptor decryptor_; |
| 279 IPC::Sender* sender_; | 280 IPC::Sender* sender_; |
| 280 }; | 281 }; |
| 281 | 282 |
| 282 // Entry function in child process. | 283 // Entry function in child process. |
| 283 MULTIPROCESS_IPC_TEST_MAIN(NSSDecrypterChildProcess) { | 284 MULTIPROCESS_IPC_TEST_MAIN(NSSDecrypterChildProcess) { |
| 284 base::MessageLoopForIO main_message_loop; | 285 base::MessageLoopForIO main_message_loop; |
| 285 FFDecryptorClientChannelListener listener; | 286 FFDecryptorClientChannelListener listener; |
| 286 | 287 |
| 287 scoped_ptr<IPC::Channel> channel = IPC::Channel::CreateClient( | 288 scoped_ptr<IPC::Channel> channel = |
| 288 kTestChannelID, &listener); | 289 IPC::Channel::CreateClient(kTestChannelID, &listener, nullptr); |
| 289 CHECK(channel->Connect()); | 290 CHECK(channel->Connect()); |
| 290 listener.SetSender(channel.get()); | 291 listener.SetSender(channel.get()); |
| 291 | 292 |
| 292 // run message loop | 293 // run message loop |
| 293 base::MessageLoop::current()->Run(); | 294 base::MessageLoop::current()->Run(); |
| 294 | 295 |
| 295 return 0; | 296 return 0; |
| 296 } | 297 } |
| OLD | NEW |