OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/base/testing_io_thread_state.h" | 5 #include "chrome/test/base/testing_io_thread_state.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/io_thread.h" | 13 #include "chrome/browser/io_thread.h" |
14 #include "chrome/test/base/testing_browser_process.h" | 14 #include "chrome/test/base/testing_browser_process.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 | 16 |
17 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
18 #include "chromeos/dbus/dbus_client_types.h" | |
19 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
20 #include "chromeos/network/network_handler.h" | 19 #include "chromeos/network/network_handler.h" |
21 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 20 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
22 #endif | 21 #endif |
23 | 22 |
24 using content::BrowserThread; | 23 using content::BrowserThread; |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 base::Closure ThreadSafeQuit(base::RunLoop* run_loop) { | 27 base::Closure ThreadSafeQuit(base::RunLoop* run_loop) { |
(...skipping 11 matching lines...) Expand all Loading... |
40 } // namespace | 39 } // namespace |
41 | 40 |
42 namespace chrome { | 41 namespace chrome { |
43 | 42 |
44 TestingIOThreadState::TestingIOThreadState() { | 43 TestingIOThreadState::TestingIOThreadState() { |
45 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
46 // Needed by IOThread constructor. | 45 // Needed by IOThread constructor. |
47 chromeos::DBusThreadManager::Initialize(); | 46 chromeos::DBusThreadManager::Initialize(); |
48 bluez::BluezDBusManager::Initialize( | 47 bluez::BluezDBusManager::Initialize( |
49 chromeos::DBusThreadManager::Get()->GetSystemBus(), | 48 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
50 chromeos::DBusThreadManager::Get()->IsUsingFake( | 49 chromeos::DBusThreadManager::Get()->IsUsingFakes()); |
51 chromeos::DBusClientType::BLUETOOTH)); | |
52 chromeos::NetworkHandler::Initialize(); | 50 chromeos::NetworkHandler::Initialize(); |
53 #endif | 51 #endif |
54 | 52 |
55 io_thread_state_.reset( | 53 io_thread_state_.reset( |
56 new IOThread(TestingBrowserProcess::GetGlobal()->local_state(), | 54 new IOThread(TestingBrowserProcess::GetGlobal()->local_state(), |
57 TestingBrowserProcess::GetGlobal()->policy_service(), | 55 TestingBrowserProcess::GetGlobal()->policy_service(), |
58 NULL, NULL)); | 56 NULL, NULL)); |
59 | 57 |
60 // Safe because there are no virtuals. | 58 // Safe because there are no virtuals. |
61 base::RunLoop run_loop; | 59 base::RunLoop run_loop; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 95 |
98 void TestingIOThreadState::Shutdown(const base::Closure& done) { | 96 void TestingIOThreadState::Shutdown(const base::Closure& done) { |
99 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 97 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
100 | 98 |
101 delete io_thread_state_->globals(); | 99 delete io_thread_state_->globals(); |
102 io_thread_state_->SetGlobalsForTesting(NULL); | 100 io_thread_state_->SetGlobalsForTesting(NULL); |
103 done.Run(); | 101 done.Run(); |
104 } | 102 } |
105 | 103 |
106 } // namespace chrome | 104 } // namespace chrome |
OLD | NEW |