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 "components/update_client/ping_manager.h" | 5 #include "components/update_client/ping_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 "<app appid=\"abc\" version=\"1.0\" nextversion=\"2.0\">" | 168 "<app appid=\"abc\" version=\"1.0\" nextversion=\"2.0\">" |
169 "<event eventtype=\"3\" eventresult=\"1\"/>" | 169 "<event eventtype=\"3\" eventresult=\"1\"/>" |
170 "<event eventtype=\"14\" eventresult=\"0\" downloader=\"direct\" " | 170 "<event eventtype=\"14\" eventresult=\"0\" downloader=\"direct\" " |
171 "errorcode=\"-1\" url=\"http://host1/path1\" downloaded=\"123\" " | 171 "errorcode=\"-1\" url=\"http://host1/path1\" downloaded=\"123\" " |
172 "total=\"456\" download_time_ms=\"987\"/>" | 172 "total=\"456\" download_time_ms=\"987\"/>" |
173 "<event eventtype=\"14\" eventresult=\"1\" downloader=\"bits\" " | 173 "<event eventtype=\"14\" eventresult=\"1\" downloader=\"bits\" " |
174 "url=\"http://host2/path2\" downloaded=\"1230\" total=\"4560\" " | 174 "url=\"http://host2/path2\" downloaded=\"1230\" total=\"4560\" " |
175 "download_time_ms=\"9870\"/></app>")) | 175 "download_time_ms=\"9870\"/></app>")) |
176 << interceptor->GetRequestsAsString(); | 176 << interceptor->GetRequestsAsString(); |
177 interceptor->Reset(); | 177 interceptor->Reset(); |
| 178 |
| 179 interceptor_factory.reset(); |
| 180 base::RunLoop().RunUntilIdle(); |
178 } | 181 } |
179 | 182 |
180 // Tests that sending the ping fails when the component requires encryption but | 183 // Tests that sending the ping fails when the component requires encryption but |
181 // the ping URL is unsecure. | 184 // the ping URL is unsecure. |
182 TEST_F(ComponentUpdaterPingManagerTest, PingManagerRequiresEncryptionTest) { | 185 TEST_F(ComponentUpdaterPingManagerTest, PingManagerRequiresEncryptionTest) { |
183 config_->SetPingUrl(GURL("http:\\foo\bar")); | 186 config_->SetPingUrl(GURL("http:\\foo\bar")); |
184 | 187 |
185 { | 188 { |
186 CrxUpdateItem item; | 189 CrxUpdateItem item; |
187 item.component.requires_network_encryption = true; | 190 item.component.requires_network_encryption = true; |
188 | 191 |
189 EXPECT_FALSE(ping_manager_->SendPing(&item)); | 192 EXPECT_FALSE(ping_manager_->SendPing(&item)); |
190 } | 193 } |
191 | 194 |
192 { | 195 { |
193 // Tests that the default for |requires_network_encryption| is true. | 196 // Tests that the default for |requires_network_encryption| is true. |
194 CrxUpdateItem item; | 197 CrxUpdateItem item; |
195 EXPECT_FALSE(ping_manager_->SendPing(&item)); | 198 EXPECT_FALSE(ping_manager_->SendPing(&item)); |
196 } | 199 } |
197 } | 200 } |
198 | 201 |
199 } // namespace update_client | 202 } // namespace update_client |
OLD | NEW |