| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" | 10 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 class BluetoothChooserControllerTest : public testing::Test { | 36 class BluetoothChooserControllerTest : public testing::Test { |
| 37 public: | 37 public: |
| 38 BluetoothChooserControllerTest() | 38 BluetoothChooserControllerTest() |
| 39 : bluetooth_chooser_controller_( | 39 : bluetooth_chooser_controller_( |
| 40 nullptr, | 40 nullptr, |
| 41 base::Bind(&BluetoothChooserControllerTest::OnBluetoothChooserEvent, | 41 base::Bind(&BluetoothChooserControllerTest::OnBluetoothChooserEvent, |
| 42 base::Unretained(this))) { | 42 base::Unretained(this)), |
| 43 true /* accept_all_devices */) { |
| 43 bluetooth_chooser_controller_.set_view(&mock_bluetooth_chooser_view_); | 44 bluetooth_chooser_controller_.set_view(&mock_bluetooth_chooser_view_); |
| 44 } | 45 } |
| 45 | 46 |
| 46 protected: | 47 protected: |
| 47 void OnBluetoothChooserEvent(content::BluetoothChooser::Event event, | 48 void OnBluetoothChooserEvent(content::BluetoothChooser::Event event, |
| 48 const std::string& device_id) { | 49 const std::string& device_id) { |
| 49 last_event_ = event; | 50 last_event_ = event; |
| 50 last_device_id_ = device_id; | 51 last_device_id_ = device_id; |
| 51 } | 52 } |
| 52 | 53 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 EXPECT_EQ(content::BluetoothChooser::Event::CANCELLED, last_event_); | 364 EXPECT_EQ(content::BluetoothChooser::Event::CANCELLED, last_event_); |
| 364 EXPECT_EQ(std::string(), last_device_id_); | 365 EXPECT_EQ(std::string(), last_device_id_); |
| 365 } | 366 } |
| 366 | 367 |
| 367 TEST_F(BluetoothChooserControllerWithDevicesAddedTest, | 368 TEST_F(BluetoothChooserControllerWithDevicesAddedTest, |
| 368 CloseShouldCallEventHandler) { | 369 CloseShouldCallEventHandler) { |
| 369 bluetooth_chooser_controller_.Close(); | 370 bluetooth_chooser_controller_.Close(); |
| 370 EXPECT_EQ(content::BluetoothChooser::Event::CANCELLED, last_event_); | 371 EXPECT_EQ(content::BluetoothChooser::Event::CANCELLED, last_event_); |
| 371 EXPECT_EQ(std::string(), last_device_id_); | 372 EXPECT_EQ(std::string(), last_device_id_); |
| 372 } | 373 } |
| OLD | NEW |