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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/scoped_native_library.h" | 8 #include "base/scoped_native_library.h" |
9 #include "remoting/base/auto_thread.h" | 9 #include "remoting/base/auto_thread.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Release |main_task_runner_|, then run |message_loop_| until other | 65 // Release |main_task_runner_|, then run |message_loop_| until other |
66 // references created in tests are gone. We also post a delayed quit | 66 // references created in tests are gone. We also post a delayed quit |
67 // task to |message_loop_| so the test will not hang on failure. | 67 // task to |message_loop_| so the test will not hang on failure. |
68 main_task_runner_ = NULL; | 68 main_task_runner_ = NULL; |
69 message_loop_.PostDelayedTask(FROM_HERE, | 69 message_loop_.PostDelayedTask(FROM_HERE, |
70 base::MessageLoop::QuitClosure(), | 70 base::MessageLoop::QuitClosure(), |
71 base::TimeDelta::FromSeconds(5)); | 71 base::TimeDelta::FromSeconds(5)); |
72 message_loop_.Run(); | 72 message_loop_.Run(); |
73 } | 73 } |
74 | 74 |
75 virtual void SetUp() override { | 75 void SetUp() override { |
76 main_task_runner_ = new AutoThreadTaskRunner( | 76 main_task_runner_ = new AutoThreadTaskRunner( |
77 message_loop_.message_loop_proxy(), | 77 message_loop_.message_loop_proxy(), |
78 base::Bind(&AutoThreadTest::QuitMainMessageLoop, | 78 base::Bind(&AutoThreadTest::QuitMainMessageLoop, |
79 base::Unretained(this))); | 79 base::Unretained(this))); |
80 } | 80 } |
81 | 81 |
82 virtual void TearDown() override { | 82 void TearDown() override { |
83 // Verify that |message_loop_| was quit by the AutoThreadTaskRunner. | 83 // Verify that |message_loop_| was quit by the AutoThreadTaskRunner. |
84 EXPECT_TRUE(message_loop_quit_correctly_); | 84 EXPECT_TRUE(message_loop_quit_correctly_); |
85 } | 85 } |
86 | 86 |
87 protected: | 87 protected: |
88 void QuitMainMessageLoop() { | 88 void QuitMainMessageLoop() { |
89 message_loop_quit_correctly_ = true; | 89 message_loop_quit_correctly_ = true; |
90 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); | 90 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); |
91 } | 91 } |
92 | 92 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Whether the thread is the "main" STA apartment depends upon previous | 192 // Whether the thread is the "main" STA apartment depends upon previous |
193 // COM activity in this test process, so allow both types here. | 193 // COM activity in this test process, so allow both types here. |
194 EXPECT_TRUE(apt_type == APTTYPE_MAINSTA || apt_type == APTTYPE_STA); | 194 EXPECT_TRUE(apt_type == APTTYPE_MAINSTA || apt_type == APTTYPE_STA); |
195 } else { | 195 } else { |
196 EXPECT_EQ(E_NOTIMPL, hresult); | 196 EXPECT_EQ(E_NOTIMPL, hresult); |
197 } | 197 } |
198 } | 198 } |
199 #endif // defined(OS_WIN) | 199 #endif // defined(OS_WIN) |
200 | 200 |
201 } // namespace remoting | 201 } // namespace remoting |
OLD | NEW |