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

Side by Side Diff: device/bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "device/bluetooth/bluez/bluetooth_adapter_profile_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_adapter_profile_bluez.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 void TearDown() override { 73 void TearDown() override {
74 profile_.reset(); 74 profile_.reset();
75 adapter_ = nullptr; 75 adapter_ = nullptr;
76 bluez::BluezDBusManager::Shutdown(); 76 bluez::BluezDBusManager::Shutdown();
77 } 77 }
78 78
79 void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { 79 void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
80 adapter_ = adapter; 80 adapter_ = adapter;
81 if (base::MessageLoop::current() && 81 if (base::RunLoop::IsRunningOnCurrentThread())
82 base::MessageLoop::current()->is_running()) {
83 base::MessageLoop::current()->QuitWhenIdle(); 82 base::MessageLoop::current()->QuitWhenIdle();
84 }
85 } 83 }
86 84
87 class FakeDelegate : public bluez::BluetoothProfileServiceProvider::Delegate { 85 class FakeDelegate : public bluez::BluetoothProfileServiceProvider::Delegate {
88 public: 86 public:
89 FakeDelegate(const std::string& device_path) : connections_(0) { 87 FakeDelegate(const std::string& device_path) : connections_(0) {
90 device_path_ = dbus::ObjectPath(device_path); 88 device_path_ = dbus::ObjectPath(device_path);
91 } 89 }
92 90
93 // bluez::BluetoothProfileServiceProvider::Delegate: 91 // bluez::BluetoothProfileServiceProvider::Delegate:
94 void Released() override { 92 void Released() override {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 base::Unretained(this))); 379 base::Unretained(this)));
382 380
383 base::RunLoop().RunUntilIdle(); 381 base::RunLoop().RunUntilIdle();
384 382
385 EXPECT_FALSE(profile_user_ptr_); 383 EXPECT_FALSE(profile_user_ptr_);
386 EXPECT_EQ(0U, success_callback_count_); 384 EXPECT_EQ(0U, success_callback_count_);
387 EXPECT_EQ(2U, error_callback_count_); 385 EXPECT_EQ(2U, error_callback_count_);
388 } 386 }
389 387
390 } // namespace bluez 388 } // namespace bluez
OLDNEW
« no previous file with comments | « content/browser/browser_thread_impl.cc ('k') | device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698