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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_apitest.cc

Issue 2017393002: bluetooth: Rename device's GetName to GetNameForDisplay (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « extensions/browser/api/bluetooth/bluetooth_api_utils.cc ('k') | no next file » | 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 <string.h> 5 #include <string.h>
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 ASSERT_TRUE(LoadExtension( 151 ASSERT_TRUE(LoadExtension(
152 test_data_dir_.AppendASCII("bluetooth/device_events"))); 152 test_data_dir_.AppendASCII("bluetooth/device_events")));
153 153
154 ExtensionTestMessageListener events_received("ready", true); 154 ExtensionTestMessageListener events_received("ready", true);
155 event_router()->DeviceAdded(mock_adapter_, device1_.get()); 155 event_router()->DeviceAdded(mock_adapter_, device1_.get());
156 event_router()->DeviceAdded(mock_adapter_, device2_.get()); 156 event_router()->DeviceAdded(mock_adapter_, device2_.get());
157 157
158 EXPECT_CALL(*device2_.get(), GetDeviceName()) 158 EXPECT_CALL(*device2_.get(), GetDeviceName())
159 .WillRepeatedly(testing::Return("the real d2")); 159 .WillRepeatedly(testing::Return("the real d2"));
160 EXPECT_CALL(*device2_.get(), GetName()) 160 EXPECT_CALL(*device2_.get(), GetNameForDisplay())
161 .WillRepeatedly(testing::Return(base::UTF8ToUTF16("the real d2"))); 161 .WillRepeatedly(testing::Return(base::UTF8ToUTF16("the real d2")));
162 event_router()->DeviceChanged(mock_adapter_, device2_.get()); 162 event_router()->DeviceChanged(mock_adapter_, device2_.get());
163 163
164 event_router()->DeviceAdded(mock_adapter_, device3_.get()); 164 event_router()->DeviceAdded(mock_adapter_, device3_.get());
165 event_router()->DeviceRemoved(mock_adapter_, device1_.get()); 165 event_router()->DeviceRemoved(mock_adapter_, device1_.get());
166 EXPECT_TRUE(events_received.WaitUntilSatisfied()); 166 EXPECT_TRUE(events_received.WaitUntilSatisfied());
167 events_received.Reply("go"); 167 events_received.Reply("go");
168 168
169 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 169 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
170 } 170 }
171 171
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 ResultCatcher catcher; 407 ResultCatcher catcher;
408 catcher.RestrictToBrowserContext(browser()->profile()); 408 catcher.RestrictToBrowserContext(browser()->profile());
409 409
410 // Set up the first device object to reflect a real-world device. 410 // Set up the first device object to reflect a real-world device.
411 BluetoothAdapter::ConstDeviceList devices; 411 BluetoothAdapter::ConstDeviceList devices;
412 412
413 EXPECT_CALL(*device1_.get(), GetAddress()) 413 EXPECT_CALL(*device1_.get(), GetAddress())
414 .WillRepeatedly(testing::Return("A4:17:31:00:00:00")); 414 .WillRepeatedly(testing::Return("A4:17:31:00:00:00"));
415 EXPECT_CALL(*device1_.get(), GetDeviceName()) 415 EXPECT_CALL(*device1_.get(), GetDeviceName())
416 .WillRepeatedly(testing::Return("Chromebook Pixel")); 416 .WillRepeatedly(testing::Return("Chromebook Pixel"));
417 EXPECT_CALL(*device1_.get(), GetName()) 417 EXPECT_CALL(*device1_.get(), GetNameForDisplay())
418 .WillRepeatedly(testing::Return(base::UTF8ToUTF16("Chromebook Pixel"))); 418 .WillRepeatedly(testing::Return(base::UTF8ToUTF16("Chromebook Pixel")));
419 EXPECT_CALL(*device1_.get(), GetBluetoothClass()) 419 EXPECT_CALL(*device1_.get(), GetBluetoothClass())
420 .WillRepeatedly(testing::Return(0x080104)); 420 .WillRepeatedly(testing::Return(0x080104));
421 EXPECT_CALL(*device1_.get(), GetDeviceType()) 421 EXPECT_CALL(*device1_.get(), GetDeviceType())
422 .WillRepeatedly(testing::Return(BluetoothDevice::DEVICE_COMPUTER)); 422 .WillRepeatedly(testing::Return(BluetoothDevice::DEVICE_COMPUTER));
423 EXPECT_CALL(*device1_.get(), GetVendorIDSource()) 423 EXPECT_CALL(*device1_.get(), GetVendorIDSource())
424 .WillRepeatedly(testing::Return(BluetoothDevice::VENDOR_ID_BLUETOOTH)); 424 .WillRepeatedly(testing::Return(BluetoothDevice::VENDOR_ID_BLUETOOTH));
425 EXPECT_CALL(*device1_.get(), GetVendorID()) 425 EXPECT_CALL(*device1_.get(), GetVendorID())
426 .WillRepeatedly(testing::Return(0x00E0)); 426 .WillRepeatedly(testing::Return(0x00E0));
427 EXPECT_CALL(*device1_.get(), GetProductID()) 427 EXPECT_CALL(*device1_.get(), GetProductID())
428 .WillRepeatedly(testing::Return(0x240A)); 428 .WillRepeatedly(testing::Return(0x240A));
(...skipping 20 matching lines...) Expand all
449 // Load and wait for setup 449 // Load and wait for setup
450 ExtensionTestMessageListener listener("ready", true); 450 ExtensionTestMessageListener listener("ready", true);
451 ASSERT_TRUE( 451 ASSERT_TRUE(
452 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); 452 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info")));
453 EXPECT_TRUE(listener.WaitUntilSatisfied()); 453 EXPECT_TRUE(listener.WaitUntilSatisfied());
454 454
455 listener.Reply("go"); 455 listener.Reply("go");
456 456
457 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 457 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
458 } 458 }
OLDNEW
« no previous file with comments | « extensions/browser/api/bluetooth/bluetooth_api_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698