Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: device/bluetooth/bluetooth_task_manager_win_unittest.cc

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turned adapter_callbacks to a lazy instance. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « device/bluetooth/bluetooth_task_manager_win.cc ('k') | device/device.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <deque> 5 #include <deque>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/test/test_pending_task.h" 9 #include "base/test/test_pending_task.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
11 #include "device/bluetooth/bluetooth_init_win.h"
11 #include "device/bluetooth/bluetooth_task_manager_win.h" 12 #include "device/bluetooth/bluetooth_task_manager_win.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace { 15 namespace {
15 16
16 class BluetoothTaskObserver : public device::BluetoothTaskManagerWin::Observer { 17 class BluetoothTaskObserver : public device::BluetoothTaskManagerWin::Observer {
17 public: 18 public:
18 BluetoothTaskObserver() : num_updates_(0) { 19 BluetoothTaskObserver() : num_updates_(0) {
19 } 20 }
20 21
(...skipping 17 matching lines...) Expand all
38 39
39 namespace device { 40 namespace device {
40 41
41 class BluetoothTaskManagerWinTest : public testing::Test { 42 class BluetoothTaskManagerWinTest : public testing::Test {
42 public: 43 public:
43 BluetoothTaskManagerWinTest() 44 BluetoothTaskManagerWinTest()
44 : ui_task_runner_(new base::TestSimpleTaskRunner()), 45 : ui_task_runner_(new base::TestSimpleTaskRunner()),
45 bluetooth_task_runner_(new base::TestSimpleTaskRunner()), 46 bluetooth_task_runner_(new base::TestSimpleTaskRunner()),
46 task_manager_(new BluetoothTaskManagerWin(ui_task_runner_, 47 task_manager_(new BluetoothTaskManagerWin(ui_task_runner_,
47 bluetooth_task_runner_)), 48 bluetooth_task_runner_)),
48 has_bluetooth_stack_(BluetoothTaskManagerWin::HasBluetoothStack()) { 49 has_bluetooth_stack_(device::bluetooth_init_win::HasBluetoothStack()) {
49 } 50 }
50 51
51 virtual void SetUp() { 52 virtual void SetUp() {
52 task_manager_->AddObserver(&observer_); 53 task_manager_->AddObserver(&observer_);
53 } 54 }
54 55
55 virtual void TearDown() { 56 virtual void TearDown() {
56 task_manager_->RemoveObserver(&observer_); 57 task_manager_->RemoveObserver(&observer_);
57 } 58 }
58 59
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 base::Closure closure; 107 base::Closure closure;
107 task_manager_->PostSetPoweredBluetoothTask(true, closure, closure); 108 task_manager_->PostSetPoweredBluetoothTask(true, closure, closure);
108 109
109 EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); 110 EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size());
110 bluetooth_task_runner_->RunPendingTasks(); 111 bluetooth_task_runner_->RunPendingTasks();
111 EXPECT_TRUE(ui_task_runner_->GetPendingTasks().size() >= 1); 112 EXPECT_TRUE(ui_task_runner_->GetPendingTasks().size() >= 1);
112 } 113 }
113 114
114 } // namespace device 115 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_task_manager_win.cc ('k') | device/device.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698