| 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() | 124 FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() |
| 125 : child_process_(0) { | 125 : child_process_(0) { |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) { | 128 bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) { |
| 129 // Create a new message loop and spawn the child process. | 129 // Create a new message loop and spawn the child process. |
| 130 message_loop_.reset(new base::MessageLoopForIO()); | 130 message_loop_.reset(new base::MessageLoopForIO()); |
| 131 | 131 |
| 132 listener_.reset(new FFDecryptorServerChannelListener()); | 132 listener_.reset(new FFDecryptorServerChannelListener()); |
| 133 channel_.reset(new IPC::Channel(kTestChannelID, | 133 channel_ = IPC::Channel::CreateServer(kTestChannelID, listener_.get()); |
| 134 IPC::Channel::MODE_SERVER, | |
| 135 listener_.get())); | |
| 136 CHECK(channel_->Connect()); | 134 CHECK(channel_->Connect()); |
| 137 listener_->SetSender(channel_.get()); | 135 listener_->SetSender(channel_.get()); |
| 138 | 136 |
| 139 // Spawn child and set up sync IPC connection. | 137 // Spawn child and set up sync IPC connection. |
| 140 bool ret = LaunchNSSDecrypterChildProcess(nss_path, | 138 bool ret = LaunchNSSDecrypterChildProcess(nss_path, |
| 141 channel_.get(), | 139 channel_.get(), |
| 142 &child_process_); | 140 &child_process_); |
| 143 return ret && (child_process_ != 0); | 141 return ret && (child_process_ != 0); |
| 144 } | 142 } |
| 145 | 143 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 private: | 255 private: |
| 258 NSSDecryptor decryptor_; | 256 NSSDecryptor decryptor_; |
| 259 IPC::Sender* sender_; | 257 IPC::Sender* sender_; |
| 260 }; | 258 }; |
| 261 | 259 |
| 262 // Entry function in child process. | 260 // Entry function in child process. |
| 263 MULTIPROCESS_IPC_TEST_MAIN(NSSDecrypterChildProcess) { | 261 MULTIPROCESS_IPC_TEST_MAIN(NSSDecrypterChildProcess) { |
| 264 base::MessageLoopForIO main_message_loop; | 262 base::MessageLoopForIO main_message_loop; |
| 265 FFDecryptorClientChannelListener listener; | 263 FFDecryptorClientChannelListener listener; |
| 266 | 264 |
| 267 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener); | 265 scoped_ptr<IPC::Channel> channel = IPC::Channel::CreateClient( |
| 268 CHECK(channel.Connect()); | 266 kTestChannelID, &listener); |
| 269 listener.SetSender(&channel); | 267 CHECK(channel->Connect()); |
| 268 listener.SetSender(channel.get()); |
| 270 | 269 |
| 271 // run message loop | 270 // run message loop |
| 272 base::MessageLoop::current()->Run(); | 271 base::MessageLoop::current()->Run(); |
| 273 | 272 |
| 274 return 0; | 273 return 0; |
| 275 } | 274 } |
| OLD | NEW |