OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/shell/shell_test_helper.h" | 5 #include "mojo/shell/shell_test_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "mojo/shell/context.h" | 10 #include "mojo/shell/context.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 ScopedMessagePipeHandle client_handle) OVERRIDE { | 44 ScopedMessagePipeHandle client_handle) OVERRIDE { |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 DISALLOW_COPY_AND_ASSIGN(TestShellClient); | 48 DISALLOW_COPY_AND_ASSIGN(TestShellClient); |
49 }; | 49 }; |
50 | 50 |
51 ShellTestHelper::ShellTestHelper() | 51 ShellTestHelper::ShellTestHelper() |
52 : shell_thread_("shell_test_helper"), | 52 : shell_thread_("shell_test_helper"), |
53 state_(NULL) { | 53 state_(NULL) { |
54 CommandLine::Init(0, NULL); | 54 base::CommandLine::Init(0, NULL); |
55 mojo::shell::InitializeLogging(); | 55 mojo::shell::InitializeLogging(); |
56 } | 56 } |
57 | 57 |
58 ShellTestHelper::~ShellTestHelper() { | 58 ShellTestHelper::~ShellTestHelper() { |
59 if (state_) { | 59 if (state_) { |
60 // |state_| contains data created on the background thread. Destroy it | 60 // |state_| contains data created on the background thread. Destroy it |
61 // there so that there aren't any race conditions. | 61 // there so that there aren't any race conditions. |
62 shell_thread_.message_loop()->DeleteSoon(FROM_HERE, state_); | 62 shell_thread_.message_loop()->DeleteSoon(FROM_HERE, state_); |
63 state_ = NULL; | 63 state_ = NULL; |
64 } | 64 } |
(...skipping 14 matching lines...) Expand all Loading... |
79 void ShellTestHelper::OnShellStarted() { | 79 void ShellTestHelper::OnShellStarted() { |
80 DCHECK(state_); | 80 DCHECK(state_); |
81 shell_client_.reset(new TestShellClient); | 81 shell_client_.reset(new TestShellClient); |
82 shell_.Bind(state_->shell_handle.Pass()); | 82 shell_.Bind(state_->shell_handle.Pass()); |
83 shell_->SetClient(shell_client_.get()); | 83 shell_->SetClient(shell_client_.get()); |
84 run_loop_->Quit(); | 84 run_loop_->Quit(); |
85 } | 85 } |
86 | 86 |
87 } // namespace shell | 87 } // namespace shell |
88 } // namespace mojo | 88 } // namespace mojo |
OLD | NEW |