OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <deque> | 5 #include <deque> |
6 | 6 |
7 #include "content/browser/child_process_security_policy_impl.h" | 7 #include "content/browser/child_process_security_policy_impl.h" |
8 #include "content/browser/media/webrtc_identity_store.h" | 8 #include "content/browser/media/webrtc_identity_store.h" |
9 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" | 9 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" |
10 #include "content/common/media/webrtc_identity_messages.h" | 10 #include "content/common/media/webrtc_identity_messages.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 void SendCancelRequestToHost() { | 110 void SendCancelRequestToHost() { |
111 host_->OnMessageReceived(WebRTCIdentityMsg_CancelRequest()); | 111 host_->OnMessageReceived(WebRTCIdentityMsg_CancelRequest()); |
112 } | 112 } |
113 | 113 |
114 void VerifyRequestFailedMessage(int error) { | 114 void VerifyRequestFailedMessage(int error) { |
115 EXPECT_EQ(1, host_->GetNumberOfMessages()); | 115 EXPECT_EQ(1, host_->GetNumberOfMessages()); |
116 IPC::Message ipc = host_->GetLastMessage(); | 116 IPC::Message ipc = host_->GetLastMessage(); |
117 EXPECT_EQ(ipc.type(), WebRTCIdentityHostMsg_RequestFailed::ID); | 117 EXPECT_EQ(ipc.type(), WebRTCIdentityHostMsg_RequestFailed::ID); |
118 | 118 |
119 Tuple<int, int> error_in_message; | 119 base::Tuple<int, int> error_in_message; |
120 WebRTCIdentityHostMsg_RequestFailed::Read(&ipc, &error_in_message); | 120 WebRTCIdentityHostMsg_RequestFailed::Read(&ipc, &error_in_message); |
121 EXPECT_EQ(FAKE_SEQUENCE_NUMBER, get<0>(error_in_message)); | 121 EXPECT_EQ(FAKE_SEQUENCE_NUMBER, base::get<0>(error_in_message)); |
122 EXPECT_EQ(error, get<1>(error_in_message)); | 122 EXPECT_EQ(error, base::get<1>(error_in_message)); |
123 } | 123 } |
124 | 124 |
125 void VerifyIdentityReadyMessage(const std::string& cert, | 125 void VerifyIdentityReadyMessage(const std::string& cert, |
126 const std::string& key) { | 126 const std::string& key) { |
127 EXPECT_EQ(1, host_->GetNumberOfMessages()); | 127 EXPECT_EQ(1, host_->GetNumberOfMessages()); |
128 IPC::Message ipc = host_->GetLastMessage(); | 128 IPC::Message ipc = host_->GetLastMessage(); |
129 EXPECT_EQ(ipc.type(), WebRTCIdentityHostMsg_IdentityReady::ID); | 129 EXPECT_EQ(ipc.type(), WebRTCIdentityHostMsg_IdentityReady::ID); |
130 | 130 |
131 Tuple<int, std::string, std::string> identity_in_message; | 131 base::Tuple<int, std::string, std::string> identity_in_message; |
132 WebRTCIdentityHostMsg_IdentityReady::Read(&ipc, &identity_in_message); | 132 WebRTCIdentityHostMsg_IdentityReady::Read(&ipc, &identity_in_message); |
133 EXPECT_EQ(FAKE_SEQUENCE_NUMBER, get<0>(identity_in_message)); | 133 EXPECT_EQ(FAKE_SEQUENCE_NUMBER, base::get<0>(identity_in_message)); |
134 EXPECT_EQ(cert, get<1>(identity_in_message)); | 134 EXPECT_EQ(cert, base::get<1>(identity_in_message)); |
135 EXPECT_EQ(key, get<2>(identity_in_message)); | 135 EXPECT_EQ(key, base::get<2>(identity_in_message)); |
136 } | 136 } |
137 | 137 |
138 protected: | 138 protected: |
139 TestBrowserThreadBundle browser_thread_bundle_; | 139 TestBrowserThreadBundle browser_thread_bundle_; |
140 scoped_refptr<MockWebRTCIdentityStore> store_; | 140 scoped_refptr<MockWebRTCIdentityStore> store_; |
141 scoped_refptr<WebRTCIdentityServiceHostForTest> host_; | 141 scoped_refptr<WebRTCIdentityServiceHostForTest> host_; |
142 }; | 142 }; |
143 | 143 |
144 } // namespace | 144 } // namespace |
145 | 145 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 | 182 |
183 // Verifies that we do not crash if we try to cancel a completed request. | 183 // Verifies that we do not crash if we try to cancel a completed request. |
184 TEST_F(WebRTCIdentityServiceHostTest, TestCancelAfterRequestCompleted) { | 184 TEST_F(WebRTCIdentityServiceHostTest, TestCancelAfterRequestCompleted) { |
185 SendRequestToHost(); | 185 SendRequestToHost(); |
186 store_->RunCompletionCallback(net::OK, FAKE_CERTIFICATE, FAKE_PRIVATE_KEY); | 186 store_->RunCompletionCallback(net::OK, FAKE_CERTIFICATE, FAKE_PRIVATE_KEY); |
187 SendCancelRequestToHost(); | 187 SendCancelRequestToHost(); |
188 } | 188 } |
189 | 189 |
190 } // namespace content | 190 } // namespace content |
OLD | NEW |