| 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "device/hid/hid_collection_info.h" | 8 #include "device/hid/hid_collection_info.h" |
| 9 #include "device/hid/hid_connection.h" | 9 #include "device/hid/hid_connection.h" |
| 10 #include "device/hid/hid_device_info.h" | 10 #include "device/hid/hid_device_info.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 base::Bind(callback, connection)); | 162 base::Bind(callback, connection)); |
| 163 } | 163 } |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 } // namespace | 166 } // namespace |
| 167 | 167 |
| 168 class HidApiTest : public ShellApiTest { | 168 class HidApiTest : public ShellApiTest { |
| 169 public: | 169 public: |
| 170 void SetUpOnMainThread() override { | 170 void SetUpOnMainThread() override { |
| 171 ShellApiTest::SetUpOnMainThread(); | 171 ShellApiTest::SetUpOnMainThread(); |
| 172 #if defined(OS_WIN) |
| 173 // TODO(reillyg): Migrate Windows backend from FILE thread to UI thread. |
| 172 base::RunLoop run_loop; | 174 base::RunLoop run_loop; |
| 173 BrowserThread::PostTaskAndReply(BrowserThread::FILE, | 175 BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, |
| 174 FROM_HERE, | |
| 175 base::Bind(&HidApiTest::SetUpService, this), | 176 base::Bind(&HidApiTest::SetUpService, this), |
| 176 run_loop.QuitClosure()); | 177 run_loop.QuitClosure()); |
| 177 run_loop.Run(); | 178 run_loop.Run(); |
| 179 #else |
| 180 SetUpService(); |
| 181 #endif |
| 178 } | 182 } |
| 179 | 183 |
| 180 void SetUpService() { HidService::SetInstanceForTest(new MockHidService()); } | 184 void SetUpService() { HidService::SetInstanceForTest(new MockHidService()); } |
| 181 }; | 185 }; |
| 182 | 186 |
| 183 IN_PROC_BROWSER_TEST_F(HidApiTest, HidApp) { | 187 IN_PROC_BROWSER_TEST_F(HidApiTest, HidApp) { |
| 184 ASSERT_TRUE(RunAppTest("api_test/hid/api")) << message_; | 188 ASSERT_TRUE(RunAppTest("api_test/hid/api")) << message_; |
| 185 } | 189 } |
| 186 | 190 |
| 187 } // namespace extensions | 191 } // namespace extensions |
| OLD | NEW |