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/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/time/default_tick_clock.h" | |
10 #include "base/time/tick_clock.h" | 9 #include "base/time/tick_clock.h" |
11 #include "chrome/browser/io_thread.h" | 10 #include "chrome/browser/io_thread.h" |
12 #include "chrome/test/base/testing_browser_process.h" | 11 #include "chrome/test/base/testing_browser_process.h" |
13 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
14 #include "net/base/network_time_notifier.h" | |
15 | 13 |
16 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
17 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
18 #include "chromeos/network/network_handler.h" | 16 #include "chromeos/network/network_handler.h" |
19 #endif | 17 #endif |
20 | 18 |
21 using content::BrowserThread; | 19 using content::BrowserThread; |
22 | 20 |
23 namespace { | 21 namespace { |
24 | 22 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
78 chromeos::NetworkHandler::Shutdown(); | 76 chromeos::NetworkHandler::Shutdown(); |
79 chromeos::DBusThreadManager::Shutdown(); | 77 chromeos::DBusThreadManager::Shutdown(); |
80 #endif | 78 #endif |
81 } | 79 } |
82 | 80 |
83 void TestingIOThreadState::Initialize(const base::Closure& done) { | 81 void TestingIOThreadState::Initialize(const base::Closure& done) { |
84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
85 | 83 |
86 io_thread_state_->SetGlobalsForTesting(new IOThread::Globals()); | 84 io_thread_state_->SetGlobalsForTesting(new IOThread::Globals()); |
87 io_thread_state_->globals()->network_time_notifier.reset( | |
88 new net::NetworkTimeNotifier( | |
89 scoped_ptr<base::TickClock>(new base::DefaultTickClock()))); | |
90 | 85 |
91 done.Run(); | 86 done.Run(); |
92 } | 87 } |
93 | 88 |
94 void TestingIOThreadState::Shutdown(const base::Closure& done) { | 89 void TestingIOThreadState::Shutdown(const base::Closure& done) { |
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
96 | 91 |
97 delete io_thread_state_->globals(); | 92 delete io_thread_state_->globals(); |
98 io_thread_state_->SetGlobalsForTesting(NULL); | 93 io_thread_state_->SetGlobalsForTesting(NULL); |
99 done.Run(); | 94 done.Run(); |
100 } | 95 } |
101 | 96 |
102 } // namespace chrome | 97 } // namespace chrome |
OLD | NEW |