| 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 "chromeos/components/tether/ble_scanner.h" | 5 #include "chromeos/components/tether/ble_scanner.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chromeos/components/tether/ble_constants.h" | 8 #include "chromeos/components/tether/ble_constants.h" |
| 9 #include "chromeos/components/tether/mock_local_device_data_provider.h" | 9 #include "chromeos/components/tether/mock_local_device_data_provider.h" |
| 10 #include "components/cryptauth/eid_data_with_timestamp.h" |
| 10 #include "components/cryptauth/mock_foreground_eid_generator.h" | 11 #include "components/cryptauth/mock_foreground_eid_generator.h" |
| 11 #include "components/cryptauth/proto/cryptauth_api.pb.h" | 12 #include "components/cryptauth/proto/cryptauth_api.pb.h" |
| 12 #include "components/cryptauth/remote_device_test_util.h" | 13 #include "components/cryptauth/remote_device_test_util.h" |
| 13 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 14 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 14 #include "device/bluetooth/test/mock_bluetooth_device.h" | 15 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 15 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" | 16 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 using testing::_; | 19 using testing::_; |
| 19 using testing::DoAll; | 20 using testing::DoAll; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const std::string fake_beacon_seed1_data = "fakeBeaconSeed1Data"; | 95 const std::string fake_beacon_seed1_data = "fakeBeaconSeed1Data"; |
| 95 const int64_t fake_beacon_seed1_start_ms = current_eid_start_ms; | 96 const int64_t fake_beacon_seed1_start_ms = current_eid_start_ms; |
| 96 const int64_t fake_beacon_seed1_end_ms = current_eid_end_ms; | 97 const int64_t fake_beacon_seed1_end_ms = current_eid_end_ms; |
| 97 | 98 |
| 98 const std::string fake_beacon_seed2_data = "fakeBeaconSeed2Data"; | 99 const std::string fake_beacon_seed2_data = "fakeBeaconSeed2Data"; |
| 99 const int64_t fake_beacon_seed2_start_ms = adjacent_eid_start_ms; | 100 const int64_t fake_beacon_seed2_start_ms = adjacent_eid_start_ms; |
| 100 const int64_t fake_beacon_seed2_end_ms = adjacent_eid_end_ms; | 101 const int64_t fake_beacon_seed2_end_ms = adjacent_eid_end_ms; |
| 101 | 102 |
| 102 std::unique_ptr<cryptauth::ForegroundEidGenerator::EidData> | 103 std::unique_ptr<cryptauth::ForegroundEidGenerator::EidData> |
| 103 CreateFakeBackgroundScanFilter() { | 104 CreateFakeBackgroundScanFilter() { |
| 104 cryptauth::ForegroundEidGenerator::DataWithTimestamp current( | 105 cryptauth::EidDataWithTimestamp current( |
| 105 current_eid_data, current_eid_start_ms, current_eid_end_ms); | 106 current_eid_data, current_eid_start_ms, current_eid_end_ms); |
| 106 | 107 |
| 107 std::unique_ptr<cryptauth::ForegroundEidGenerator::DataWithTimestamp> | 108 std::unique_ptr<cryptauth::EidDataWithTimestamp> adjacent = |
| 108 adjacent = base::MakeUnique< | 109 base::MakeUnique<cryptauth::EidDataWithTimestamp>( |
| 109 cryptauth::ForegroundEidGenerator::DataWithTimestamp>( | |
| 110 adjacent_eid_data, adjacent_eid_start_ms, adjacent_eid_end_ms); | 110 adjacent_eid_data, adjacent_eid_start_ms, adjacent_eid_end_ms); |
| 111 | 111 |
| 112 return base::MakeUnique<cryptauth::ForegroundEidGenerator::EidData>( | 112 return base::MakeUnique<cryptauth::ForegroundEidGenerator::EidData>( |
| 113 current, std::move(adjacent)); | 113 current, std::move(adjacent)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 std::vector<cryptauth::BeaconSeed> CreateFakeBeaconSeeds() { | 116 std::vector<cryptauth::BeaconSeed> CreateFakeBeaconSeeds() { |
| 117 cryptauth::BeaconSeed seed1; | 117 cryptauth::BeaconSeed seed1; |
| 118 seed1.set_data(fake_beacon_seed1_data); | 118 seed1.set_data(fake_beacon_seed1_data); |
| 119 seed1.set_start_time_millis(fake_beacon_seed1_start_ms); | 119 seed1.set_start_time_millis(fake_beacon_seed1_start_ms); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // Unregister device. | 557 // Unregister device. |
| 558 EXPECT_TRUE(ble_scanner_->IsDeviceRegistered(test_devices_[0].GetDeviceId())); | 558 EXPECT_TRUE(ble_scanner_->IsDeviceRegistered(test_devices_[0].GetDeviceId())); |
| 559 EXPECT_TRUE(ble_scanner_->UnregisterScanFilterForDevice(test_devices_[0])); | 559 EXPECT_TRUE(ble_scanner_->UnregisterScanFilterForDevice(test_devices_[0])); |
| 560 EXPECT_FALSE( | 560 EXPECT_FALSE( |
| 561 ble_scanner_->IsDeviceRegistered(test_devices_[0].GetDeviceId())); | 561 ble_scanner_->IsDeviceRegistered(test_devices_[0].GetDeviceId())); |
| 562 } | 562 } |
| 563 | 563 |
| 564 } // namespace tether | 564 } // namespace tether |
| 565 | 565 |
| 566 } // namespace chromeos | 566 } // namespace chromeos |
| OLD | NEW |