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

Side by Side Diff: chrome/browser/metrics/chromeos_metrics_provider_unittest.cc

Issue 2315443004: Remove calls to deprecated MessageLoop methods in chrome. (Closed)
Patch Set: remove unused include Created 4 years, 3 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 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 "chrome/browser/metrics/chromeos_metrics_provider.h" 5 #include "chrome/browser/metrics/chromeos_metrics_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h"
11 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 12 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
12 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
13 #include "chrome/browser/metrics/chromeos_metrics_provider.h" 14 #include "chrome/browser/metrics/chromeos_metrics_provider.h"
14 #include "chromeos/dbus/dbus_thread_manager.h" 15 #include "chromeos/dbus/dbus_thread_manager.h"
15 #include "chromeos/dbus/power_manager_client.h" 16 #include "chromeos/dbus/power_manager_client.h"
16 #include "chromeos/login/login_state.h" 17 #include "chromeos/login/login_state.h"
17 #include "components/metrics/proto/system_profile.pb.h" 18 #include "components/metrics/proto/system_profile.pb.h"
18 #include "components/user_manager/user_manager.h" 19 #include "components/user_manager/user_manager.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 20 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "content/public/test/test_utils.h" 21 #include "content/public/test/test_utils.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 }; 122 };
122 123
123 // Wrapper around ChromeOSMetricsProvider that initializes 124 // Wrapper around ChromeOSMetricsProvider that initializes
124 // BluetoothAdapter in the constructor. 125 // BluetoothAdapter in the constructor.
125 class TestChromeOSMetricsProvider : public ChromeOSMetricsProvider { 126 class TestChromeOSMetricsProvider : public ChromeOSMetricsProvider {
126 public: 127 public:
127 TestChromeOSMetricsProvider() { 128 TestChromeOSMetricsProvider() {
128 InitTaskGetBluetoothAdapter( 129 InitTaskGetBluetoothAdapter(
129 base::Bind(&TestChromeOSMetricsProvider::GetBluetoothAdapterCallback, 130 base::Bind(&TestChromeOSMetricsProvider::GetBluetoothAdapterCallback,
130 base::Unretained(this))); 131 base::Unretained(this)));
131 base::MessageLoop::current()->Run(); 132 base::RunLoop().Run();
132 } 133 }
133 void GetBluetoothAdapterCallback() { 134 void GetBluetoothAdapterCallback() {
134 ASSERT_TRUE(base::MessageLoop::current()->is_running()); 135 ASSERT_TRUE(base::MessageLoop::current()->is_running());
135 base::MessageLoop::current()->QuitWhenIdle(); 136 base::MessageLoop::current()->QuitWhenIdle();
136 } 137 }
137 }; 138 };
138 139
139 TEST_F(ChromeOSMetricsProviderTest, MultiProfileUserCount) { 140 TEST_F(ChromeOSMetricsProviderTest, MultiProfileUserCount) {
140 const AccountId account_id1(AccountId::FromUserEmail("user1@example.com")); 141 const AccountId account_id1(AccountId::FromUserEmail("user1@example.com"));
141 const AccountId account_id2(AccountId::FromUserEmail("user2@example.com")); 142 const AccountId account_id2(AccountId::FromUserEmail("user2@example.com"));
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 EXPECT_EQ(0x030DU, device1.product_id()); 280 EXPECT_EQ(0x030DU, device1.product_id());
280 EXPECT_EQ(0x0306U, device1.device_id()); 281 EXPECT_EQ(0x0306U, device1.device_id());
281 282
282 // The Confirm Passkey object, this has no Device ID information. 283 // The Confirm Passkey object, this has no Device ID information.
283 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, 284 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass,
284 device2.bluetooth_class()); 285 device2.bluetooth_class());
285 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); 286 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type());
286 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); 287 EXPECT_EQ(0x207D74U, device2.vendor_prefix());
287 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); 288 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source());
288 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698