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/disconnect_tethering_operation.h" | 5 #include "chromeos/components/tether/disconnect_tethering_operation.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chromeos/components/tether/fake_ble_connection_manager.h" | 10 #include "chromeos/components/tether/fake_ble_connection_manager.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 void SimulateDeviceAuthenticationAndVerifyMessageSent() { | 72 void SimulateDeviceAuthenticationAndVerifyMessageSent() { |
73 operation_->OnDeviceAuthenticated(test_device_); | 73 operation_->OnDeviceAuthenticated(test_device_); |
74 | 74 |
75 // Verify that the message was sent successfully. | 75 // Verify that the message was sent successfully. |
76 std::vector<FakeBleConnectionManager::SentMessage>& sent_messages = | 76 std::vector<FakeBleConnectionManager::SentMessage>& sent_messages = |
77 fake_ble_connection_manager_->sent_messages(); | 77 fake_ble_connection_manager_->sent_messages(); |
78 ASSERT_EQ(1u, sent_messages.size()); | 78 ASSERT_EQ(1u, sent_messages.size()); |
79 EXPECT_EQ(test_device_, sent_messages[0].remote_device); | 79 EXPECT_EQ(test_device_, sent_messages[0].remote_device); |
80 EXPECT_EQ(disconnect_tethering_request_string_, sent_messages[0].message); | 80 EXPECT_EQ(disconnect_tethering_request_string_, sent_messages[0].message); |
| 81 |
| 82 // There should be no response timers set for DisconnectTetheringOperation. |
| 83 EXPECT_FALSE( |
| 84 operation_->GetResponseTimerForDevice(sent_messages[0].remote_device)); |
81 } | 85 } |
82 | 86 |
83 void SimulateConnectionTimeout() { | 87 void SimulateConnectionTimeout() { |
84 operation_->UnregisterDevice(test_device_); | 88 operation_->UnregisterDevice(test_device_); |
85 } | 89 } |
86 | 90 |
87 const std::string disconnect_tethering_request_string_; | 91 const std::string disconnect_tethering_request_string_; |
88 const cryptauth::RemoteDevice test_device_; | 92 const cryptauth::RemoteDevice test_device_; |
89 | 93 |
90 std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_; | 94 std::unique_ptr<FakeBleConnectionManager> fake_ble_connection_manager_; |
(...skipping 13 matching lines...) Expand all Loading... |
104 | 108 |
105 TEST_F(DisconnectTetheringOperationTest, TestFailure) { | 109 TEST_F(DisconnectTetheringOperationTest, TestFailure) { |
106 SimulateConnectionTimeout(); | 110 SimulateConnectionTimeout(); |
107 EXPECT_EQ(test_device_.GetDeviceId(), test_observer_->last_device_id()); | 111 EXPECT_EQ(test_device_.GetDeviceId(), test_observer_->last_device_id()); |
108 EXPECT_FALSE(test_observer_->WasLastOperationSuccessful()); | 112 EXPECT_FALSE(test_observer_->WasLastOperationSuccessful()); |
109 } | 113 } |
110 | 114 |
111 } // namespace tether | 115 } // namespace tether |
112 | 116 |
113 } // namespace cryptauth | 117 } // namespace cryptauth |
OLD | NEW |