| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/tether_disconnector.h" | 5 #include "chromeos/components/tether/tether_disconnector.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chromeos/components/tether/connect_tethering_operation.h" | 9 #include "chromeos/components/tether/connect_tethering_operation.h" |
| 10 #include "chromeos/components/tether/device_id_tether_network_guid_map.h" | 10 #include "chromeos/components/tether/device_id_tether_network_guid_map.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 ss << "{" | 41 ss << "{" |
| 42 << " \"GUID\": \"" << kWifiNetworkGuid << "\"," | 42 << " \"GUID\": \"" << kWifiNetworkGuid << "\"," |
| 43 << " \"Type\": \"" << shill::kTypeWifi << "\"," | 43 << " \"Type\": \"" << shill::kTypeWifi << "\"," |
| 44 << " \"State\": \"" << shill::kStateOnline << "\"" | 44 << " \"State\": \"" << shill::kStateOnline << "\"" |
| 45 << "}"; | 45 << "}"; |
| 46 return ss.str(); | 46 return ss.str(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 class TestNetworkConnectionHandler : public NetworkConnectionHandler { | 49 class TestNetworkConnectionHandler : public NetworkConnectionHandler { |
| 50 public: | 50 public: |
| 51 TestNetworkConnectionHandler(base::Closure disconnect_callback) | 51 explicit TestNetworkConnectionHandler(base::Closure disconnect_callback) |
| 52 : disconnect_callback_(disconnect_callback) {} | 52 : disconnect_callback_(disconnect_callback) {} |
| 53 ~TestNetworkConnectionHandler() override {} | 53 ~TestNetworkConnectionHandler() override {} |
| 54 | 54 |
| 55 std::string last_disconnect_service_path() { | 55 std::string last_disconnect_service_path() { |
| 56 return last_disconnect_service_path_; | 56 return last_disconnect_service_path_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 base::Closure last_disconnect_success_callback() { | 59 base::Closure last_disconnect_success_callback() { |
| 60 return last_disconnect_success_callback_; | 60 return last_disconnect_success_callback_; |
| 61 } | 61 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 class TestTetherConnector : public TetherConnector { | 99 class TestTetherConnector : public TetherConnector { |
| 100 public: | 100 public: |
| 101 TestTetherConnector() | 101 TestTetherConnector() |
| 102 : TetherConnector(nullptr /* network_state_handler */, | 102 : TetherConnector(nullptr /* network_state_handler */, |
| 103 nullptr /* wifi_hotspot_connector */, | 103 nullptr /* wifi_hotspot_connector */, |
| 104 nullptr /* active_host */, | 104 nullptr /* active_host */, |
| 105 nullptr /* tether_host_fetcher */, | 105 nullptr /* tether_host_fetcher */, |
| 106 nullptr /* connection_manager */, | 106 nullptr /* connection_manager */, |
| 107 nullptr /* tether_host_response_recorder */, | 107 nullptr /* tether_host_response_recorder */, |
| 108 nullptr /* device_id_tether_network_guid_map */), | 108 nullptr /* device_id_tether_network_guid_map */, |
| 109 nullptr /* host_scan_cache */, |
| 110 nullptr /* notification_presenter */), |
| 109 should_cancel_successfully_(true) {} | 111 should_cancel_successfully_(true) {} |
| 110 ~TestTetherConnector() override {} | 112 ~TestTetherConnector() override {} |
| 111 | 113 |
| 112 void set_should_cancel_successfully(bool should_cancel_successfully) { | 114 void set_should_cancel_successfully(bool should_cancel_successfully) { |
| 113 should_cancel_successfully_ = should_cancel_successfully; | 115 should_cancel_successfully_ = should_cancel_successfully; |
| 114 } | 116 } |
| 115 | 117 |
| 116 std::string last_canceled_tether_network_guid() { | 118 std::string last_canceled_tether_network_guid() { |
| 117 return last_canceled_tether_network_guid_; | 119 return last_canceled_tether_network_guid_; |
| 118 } | 120 } |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 EXPECT_EQ(kSuccessResult, GetResultAndReset()); | 583 EXPECT_EQ(kSuccessResult, GetResultAndReset()); |
| 582 | 584 |
| 583 // Stop the test here, before the operation responds in any way. This test | 585 // Stop the test here, before the operation responds in any way. This test |
| 584 // ensures that TetherDisconnector properly removes existing listeners if it | 586 // ensures that TetherDisconnector properly removes existing listeners if it |
| 585 // is destroyed while there are still active operations. | 587 // is destroyed while there are still active operations. |
| 586 } | 588 } |
| 587 | 589 |
| 588 } // namespace tether | 590 } // namespace tether |
| 589 | 591 |
| 590 } // namespace chromeos | 592 } // namespace chromeos |
| OLD | NEW |