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/host_scanner.h" | 5 #include "chromeos/components/tether/host_scanner.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/test/scoped_task_environment.h" | |
14 #include "base/test/simple_test_clock.h" | 13 #include "base/test/simple_test_clock.h" |
15 #include "base/time/time.h" | 14 #include "base/time/time.h" |
16 #include "chromeos/components/tether/device_id_tether_network_guid_map.h" | 15 #include "chromeos/components/tether/device_id_tether_network_guid_map.h" |
17 #include "chromeos/components/tether/fake_ble_connection_manager.h" | 16 #include "chromeos/components/tether/fake_ble_connection_manager.h" |
18 #include "chromeos/components/tether/fake_host_scan_cache.h" | 17 #include "chromeos/components/tether/fake_host_scan_cache.h" |
19 #include "chromeos/components/tether/fake_notification_presenter.h" | 18 #include "chromeos/components/tether/fake_notification_presenter.h" |
20 #include "chromeos/components/tether/fake_tether_host_fetcher.h" | 19 #include "chromeos/components/tether/fake_tether_host_fetcher.h" |
21 #include "chromeos/components/tether/host_scan_device_prioritizer.h" | 20 #include "chromeos/components/tether/host_scan_device_prioritizer.h" |
22 #include "chromeos/components/tether/host_scanner.h" | 21 #include "chromeos/components/tether/host_scanner.h" |
23 #include "chromeos/components/tether/mock_tether_host_response_recorder.h" | 22 #include "chromeos/components/tether/mock_tether_host_response_recorder.h" |
(...skipping 13 matching lines...) Expand all Loading... |
37 void ScanFinished() override { scan_finished_count_++; } | 36 void ScanFinished() override { scan_finished_count_++; } |
38 | 37 |
39 int scan_finished_count() { return scan_finished_count_; } | 38 int scan_finished_count() { return scan_finished_count_; } |
40 | 39 |
41 private: | 40 private: |
42 int scan_finished_count_ = 0; | 41 int scan_finished_count_ = 0; |
43 }; | 42 }; |
44 | 43 |
45 class FakeHostScanDevicePrioritizer : public HostScanDevicePrioritizer { | 44 class FakeHostScanDevicePrioritizer : public HostScanDevicePrioritizer { |
46 public: | 45 public: |
47 FakeHostScanDevicePrioritizer() : HostScanDevicePrioritizer(nullptr) {} | 46 FakeHostScanDevicePrioritizer() : HostScanDevicePrioritizer() {} |
48 ~FakeHostScanDevicePrioritizer() override {} | 47 ~FakeHostScanDevicePrioritizer() override {} |
49 | 48 |
50 // Simply leave |remote_devices| as-is. | 49 // Simply leave |remote_devices| as-is. |
51 void SortByHostScanOrder( | 50 void SortByHostScanOrder( |
52 std::vector<cryptauth::RemoteDevice>* remote_devices) const override {} | 51 std::vector<cryptauth::RemoteDevice>* remote_devices) const override {} |
53 }; | 52 }; |
54 | 53 |
55 class FakeHostScannerOperation : public HostScannerOperation { | 54 class FakeHostScannerOperation : public HostScannerOperation { |
56 public: | 55 public: |
57 FakeHostScannerOperation( | 56 FakeHostScannerOperation( |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 EXPECT_TRUE(host_scanner_->HasRecentlyScanned()); | 565 EXPECT_TRUE(host_scanner_->HasRecentlyScanned()); |
567 | 566 |
568 // Move past the limit. | 567 // Move past the limit. |
569 test_clock_->Advance(base::TimeDelta::FromSeconds(1)); | 568 test_clock_->Advance(base::TimeDelta::FromSeconds(1)); |
570 EXPECT_FALSE(host_scanner_->HasRecentlyScanned()); | 569 EXPECT_FALSE(host_scanner_->HasRecentlyScanned()); |
571 } | 570 } |
572 | 571 |
573 } // namespace tether | 572 } // namespace tether |
574 | 573 |
575 } // namespace chromeos | 574 } // namespace chromeos |
OLD | NEW |