OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "components/prefs/testing_pref_service.h" |
15 #include "components/update_client/crx_update_item.h" | 16 #include "components/update_client/crx_update_item.h" |
| 17 #include "components/update_client/persisted_data.h" |
16 #include "components/update_client/test_configurator.h" | 18 #include "components/update_client/test_configurator.h" |
17 #include "components/update_client/update_checker.h" | 19 #include "components/update_client/update_checker.h" |
18 #include "components/update_client/url_request_post_interceptor.h" | 20 #include "components/update_client/url_request_post_interceptor.h" |
19 #include "net/url_request/url_request_test_util.h" | 21 #include "net/url_request/url_request_test_util.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "url/gurl.h" | 23 #include "url/gurl.h" |
22 | 24 |
23 using std::string; | 25 using std::string; |
24 | 26 |
25 namespace update_client { | 27 namespace update_client { |
(...skipping 26 matching lines...) Expand all Loading... |
52 int retry_after_sec); | 54 int retry_after_sec); |
53 | 55 |
54 protected: | 56 protected: |
55 void Quit(); | 57 void Quit(); |
56 void RunThreads(); | 58 void RunThreads(); |
57 void RunThreadsUntilIdle(); | 59 void RunThreadsUntilIdle(); |
58 | 60 |
59 CrxUpdateItem BuildCrxUpdateItem(); | 61 CrxUpdateItem BuildCrxUpdateItem(); |
60 | 62 |
61 scoped_refptr<TestConfigurator> config_; | 63 scoped_refptr<TestConfigurator> config_; |
| 64 scoped_refptr<PersistedData> metadata_; |
62 | 65 |
63 scoped_ptr<UpdateChecker> update_checker_; | 66 scoped_ptr<UpdateChecker> update_checker_; |
64 | 67 |
65 scoped_ptr<InterceptorFactory> interceptor_factory_; | 68 scoped_ptr<InterceptorFactory> interceptor_factory_; |
66 URLRequestPostInterceptor* post_interceptor_; // Owned by the factory. | 69 URLRequestPostInterceptor* post_interceptor_; // Owned by the factory. |
67 | 70 |
68 int error_; | 71 int error_; |
69 UpdateResponse::Results results_; | 72 UpdateResponse::Results results_; |
70 | 73 |
71 private: | 74 private: |
72 base::MessageLoopForIO loop_; | 75 base::MessageLoopForIO loop_; |
73 base::Closure quit_closure_; | 76 base::Closure quit_closure_; |
74 | 77 |
75 DISALLOW_COPY_AND_ASSIGN(UpdateCheckerTest); | 78 DISALLOW_COPY_AND_ASSIGN(UpdateCheckerTest); |
76 }; | 79 }; |
77 | 80 |
78 UpdateCheckerTest::UpdateCheckerTest() : post_interceptor_(NULL), error_(0) { | 81 UpdateCheckerTest::UpdateCheckerTest() : post_interceptor_(NULL), error_(0) { |
79 } | 82 } |
80 | 83 |
81 UpdateCheckerTest::~UpdateCheckerTest() { | 84 UpdateCheckerTest::~UpdateCheckerTest() { |
82 } | 85 } |
83 | 86 |
84 void UpdateCheckerTest::SetUp() { | 87 void UpdateCheckerTest::SetUp() { |
85 config_ = new TestConfigurator(base::ThreadTaskRunnerHandle::Get(), | 88 config_ = new TestConfigurator(base::ThreadTaskRunnerHandle::Get(), |
86 base::ThreadTaskRunnerHandle::Get()); | 89 base::ThreadTaskRunnerHandle::Get()); |
| 90 TestingPrefServiceSimple* pref = new TestingPrefServiceSimple(); |
| 91 RegisterPersistedDataPreferences(pref->registry()); |
| 92 metadata_ = new PersistedData(pref); |
87 interceptor_factory_.reset( | 93 interceptor_factory_.reset( |
88 new InterceptorFactory(base::ThreadTaskRunnerHandle::Get())); | 94 new InterceptorFactory(base::ThreadTaskRunnerHandle::Get())); |
89 post_interceptor_ = interceptor_factory_->CreateInterceptor(); | 95 post_interceptor_ = interceptor_factory_->CreateInterceptor(); |
90 EXPECT_TRUE(post_interceptor_); | 96 EXPECT_TRUE(post_interceptor_); |
91 | 97 |
92 update_checker_.reset(); | 98 update_checker_.reset(); |
93 | 99 |
94 error_ = 0; | 100 error_ = 0; |
95 results_ = UpdateResponse::Results(); | 101 results_ = UpdateResponse::Results(); |
96 } | 102 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 crx_update_item.id = "jebgalgnebhfojomionfpkfelancnnkf"; | 157 crx_update_item.id = "jebgalgnebhfojomionfpkfelancnnkf"; |
152 crx_update_item.component = crx_component; | 158 crx_update_item.component = crx_component; |
153 | 159 |
154 return crx_update_item; | 160 return crx_update_item; |
155 } | 161 } |
156 | 162 |
157 TEST_F(UpdateCheckerTest, UpdateCheckSuccess) { | 163 TEST_F(UpdateCheckerTest, UpdateCheckSuccess) { |
158 EXPECT_TRUE(post_interceptor_->ExpectRequest( | 164 EXPECT_TRUE(post_interceptor_->ExpectRequest( |
159 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); | 165 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); |
160 | 166 |
161 update_checker_ = UpdateChecker::Create(config_); | 167 update_checker_ = UpdateChecker::Create(config_, metadata_); |
162 | 168 |
163 CrxUpdateItem item(BuildCrxUpdateItem()); | 169 CrxUpdateItem item(BuildCrxUpdateItem()); |
164 std::vector<CrxUpdateItem*> items_to_check; | 170 std::vector<CrxUpdateItem*> items_to_check; |
165 items_to_check.push_back(&item); | 171 items_to_check.push_back(&item); |
166 | 172 |
167 update_checker_->CheckForUpdates( | 173 update_checker_->CheckForUpdates( |
168 items_to_check, "extra=\"params\"", | 174 items_to_check, "extra=\"params\"", |
169 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, | 175 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
170 base::Unretained(this))); | 176 base::Unretained(this))); |
171 | 177 |
172 RunThreads(); | 178 RunThreads(); |
173 | 179 |
174 EXPECT_EQ(1, post_interceptor_->GetHitCount()) | 180 EXPECT_EQ(1, post_interceptor_->GetHitCount()) |
175 << post_interceptor_->GetRequestsAsString(); | 181 << post_interceptor_->GetRequestsAsString(); |
176 ASSERT_EQ(1, post_interceptor_->GetCount()) | 182 ASSERT_EQ(1, post_interceptor_->GetCount()) |
177 << post_interceptor_->GetRequestsAsString(); | 183 << post_interceptor_->GetRequestsAsString(); |
178 | 184 |
179 // Sanity check the request. | 185 // Sanity check the request. |
180 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( | 186 EXPECT_NE(string::npos, post_interceptor_->GetRequests()[0].find( |
181 "request protocol=\"3.0\" extra=\"params\"")); | 187 "request protocol=\"3.0\" extra=\"params\"")); |
182 // The request must not contain any "dlpref" in the default case. | 188 // The request must not contain any "dlpref" in the default case. |
183 EXPECT_EQ(string::npos, | 189 EXPECT_EQ(string::npos, |
184 post_interceptor_->GetRequests()[0].find(" dlpref=\"")); | 190 post_interceptor_->GetRequests()[0].find(" dlpref=\"")); |
185 EXPECT_NE( | 191 EXPECT_NE( |
186 string::npos, | 192 string::npos, |
187 post_interceptor_->GetRequests()[0].find( | 193 post_interceptor_->GetRequests()[0].find( |
188 "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" " | 194 "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" " |
189 "brand=\"TEST\"><updatecheck />" | 195 "brand=\"TEST\"><updatecheck /><ping rd=\"-2\" />" |
190 "<packages><package fp=\"fp1\"/></packages></app>")); | 196 "<packages><package fp=\"fp1\"/></packages></app>")); |
191 | 197 |
192 EXPECT_NE(string::npos, | 198 EXPECT_NE(string::npos, |
193 post_interceptor_->GetRequests()[0].find("<hw physmemory=")); | 199 post_interceptor_->GetRequests()[0].find("<hw physmemory=")); |
194 | 200 |
195 // Sanity check the arguments of the callback after parsing. | 201 // Sanity check the arguments of the callback after parsing. |
196 EXPECT_EQ(0, error_); | 202 EXPECT_EQ(0, error_); |
197 EXPECT_EQ(1ul, results_.list.size()); | 203 EXPECT_EQ(1ul, results_.list.size()); |
198 EXPECT_STREQ("jebgalgnebhfojomionfpkfelancnnkf", | 204 EXPECT_STREQ("jebgalgnebhfojomionfpkfelancnnkf", |
199 results_.list[0].extension_id.c_str()); | 205 results_.list[0].extension_id.c_str()); |
200 EXPECT_STREQ("1.0", results_.list[0].manifest.version.c_str()); | 206 EXPECT_STREQ("1.0", results_.list[0].manifest.version.c_str()); |
201 } | 207 } |
202 | 208 |
203 TEST_F(UpdateCheckerTest, UpdateCheckSuccessNoBrand) { | 209 TEST_F(UpdateCheckerTest, UpdateCheckSuccessNoBrand) { |
204 EXPECT_TRUE(post_interceptor_->ExpectRequest( | 210 EXPECT_TRUE(post_interceptor_->ExpectRequest( |
205 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); | 211 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); |
206 | 212 |
207 config_->SetBrand("TOOLONG"); // Sets an invalid brand code. | 213 config_->SetBrand("TOOLONG"); // Sets an invalid brand code. |
208 update_checker_ = UpdateChecker::Create(config_); | 214 update_checker_ = UpdateChecker::Create(config_, metadata_); |
209 | 215 |
210 CrxUpdateItem item(BuildCrxUpdateItem()); | 216 CrxUpdateItem item(BuildCrxUpdateItem()); |
211 std::vector<CrxUpdateItem*> items_to_check; | 217 std::vector<CrxUpdateItem*> items_to_check; |
212 items_to_check.push_back(&item); | 218 items_to_check.push_back(&item); |
213 | 219 |
214 update_checker_->CheckForUpdates( | 220 update_checker_->CheckForUpdates( |
215 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, | 221 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
216 base::Unretained(this))); | 222 base::Unretained(this))); |
217 | 223 |
218 RunThreads(); | 224 RunThreads(); |
219 | 225 |
220 EXPECT_NE( | 226 EXPECT_NE( |
221 string::npos, | 227 string::npos, |
222 post_interceptor_->GetRequests()[0].find( | 228 post_interceptor_->GetRequests()[0].find( |
223 "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">" | 229 "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">" |
224 "<updatecheck /><packages><package fp=\"fp1\"/></packages></app>")); | 230 "<updatecheck /><ping rd=\"-2\" /><packages><package fp=\"fp1\"/>" |
| 231 "</packages></app>")); |
225 } | 232 } |
226 | 233 |
227 // Simulates a 403 server response error. | 234 // Simulates a 403 server response error. |
228 TEST_F(UpdateCheckerTest, UpdateCheckError) { | 235 TEST_F(UpdateCheckerTest, UpdateCheckError) { |
229 EXPECT_TRUE( | 236 EXPECT_TRUE( |
230 post_interceptor_->ExpectRequest(new PartialMatch("updatecheck"), 403)); | 237 post_interceptor_->ExpectRequest(new PartialMatch("updatecheck"), 403)); |
231 | 238 |
232 update_checker_ = UpdateChecker::Create(config_); | 239 update_checker_ = UpdateChecker::Create(config_, metadata_); |
233 | 240 |
234 CrxUpdateItem item(BuildCrxUpdateItem()); | 241 CrxUpdateItem item(BuildCrxUpdateItem()); |
235 std::vector<CrxUpdateItem*> items_to_check; | 242 std::vector<CrxUpdateItem*> items_to_check; |
236 items_to_check.push_back(&item); | 243 items_to_check.push_back(&item); |
237 | 244 |
238 update_checker_->CheckForUpdates( | 245 update_checker_->CheckForUpdates( |
239 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, | 246 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
240 base::Unretained(this))); | 247 base::Unretained(this))); |
241 RunThreads(); | 248 RunThreads(); |
242 | 249 |
243 EXPECT_EQ(1, post_interceptor_->GetHitCount()) | 250 EXPECT_EQ(1, post_interceptor_->GetHitCount()) |
244 << post_interceptor_->GetRequestsAsString(); | 251 << post_interceptor_->GetRequestsAsString(); |
245 EXPECT_EQ(1, post_interceptor_->GetCount()) | 252 EXPECT_EQ(1, post_interceptor_->GetCount()) |
246 << post_interceptor_->GetRequestsAsString(); | 253 << post_interceptor_->GetRequestsAsString(); |
247 | 254 |
248 EXPECT_EQ(403, error_); | 255 EXPECT_EQ(403, error_); |
249 EXPECT_EQ(0ul, results_.list.size()); | 256 EXPECT_EQ(0ul, results_.list.size()); |
250 } | 257 } |
251 | 258 |
252 TEST_F(UpdateCheckerTest, UpdateCheckDownloadPreference) { | 259 TEST_F(UpdateCheckerTest, UpdateCheckDownloadPreference) { |
253 EXPECT_TRUE(post_interceptor_->ExpectRequest( | 260 EXPECT_TRUE(post_interceptor_->ExpectRequest( |
254 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); | 261 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); |
255 | 262 |
256 config_->SetDownloadPreference(string("cacheable")); | 263 config_->SetDownloadPreference(string("cacheable")); |
257 | 264 |
258 update_checker_ = UpdateChecker::Create(config_); | 265 update_checker_ = UpdateChecker::Create(config_, metadata_); |
259 | 266 |
260 CrxUpdateItem item(BuildCrxUpdateItem()); | 267 CrxUpdateItem item(BuildCrxUpdateItem()); |
261 std::vector<CrxUpdateItem*> items_to_check; | 268 std::vector<CrxUpdateItem*> items_to_check; |
262 items_to_check.push_back(&item); | 269 items_to_check.push_back(&item); |
263 | 270 |
264 update_checker_->CheckForUpdates( | 271 update_checker_->CheckForUpdates( |
265 items_to_check, "extra=\"params\"", | 272 items_to_check, "extra=\"params\"", |
266 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, | 273 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
267 base::Unretained(this))); | 274 base::Unretained(this))); |
268 | 275 |
269 RunThreads(); | 276 RunThreads(); |
270 | 277 |
271 // The request must contain dlpref="cacheable". | 278 // The request must contain dlpref="cacheable". |
272 EXPECT_NE(string::npos, | 279 EXPECT_NE(string::npos, |
273 post_interceptor_->GetRequests()[0].find(" dlpref=\"cacheable\"")); | 280 post_interceptor_->GetRequests()[0].find(" dlpref=\"cacheable\"")); |
274 } | 281 } |
275 | 282 |
276 // This test is checking that an update check signed with CUP fails, since there | 283 // This test is checking that an update check signed with CUP fails, since there |
277 // is currently no entity that can respond with a valid signed response. | 284 // is currently no entity that can respond with a valid signed response. |
278 // A proper CUP test requires network mocks, which are not available now. | 285 // A proper CUP test requires network mocks, which are not available now. |
279 TEST_F(UpdateCheckerTest, UpdateCheckCupError) { | 286 TEST_F(UpdateCheckerTest, UpdateCheckCupError) { |
280 EXPECT_TRUE(post_interceptor_->ExpectRequest( | 287 EXPECT_TRUE(post_interceptor_->ExpectRequest( |
281 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); | 288 new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); |
282 | 289 |
283 config_->SetUseCupSigning(true); | 290 config_->SetUseCupSigning(true); |
284 update_checker_ = UpdateChecker::Create(config_); | 291 update_checker_ = UpdateChecker::Create(config_, metadata_); |
285 | 292 |
286 CrxUpdateItem item(BuildCrxUpdateItem()); | 293 CrxUpdateItem item(BuildCrxUpdateItem()); |
287 std::vector<CrxUpdateItem*> items_to_check; | 294 std::vector<CrxUpdateItem*> items_to_check; |
288 items_to_check.push_back(&item); | 295 items_to_check.push_back(&item); |
289 | 296 |
290 update_checker_->CheckForUpdates( | 297 update_checker_->CheckForUpdates( |
291 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, | 298 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
292 base::Unretained(this))); | 299 base::Unretained(this))); |
293 | 300 |
294 RunThreads(); | 301 RunThreads(); |
295 | 302 |
296 EXPECT_EQ(1, post_interceptor_->GetHitCount()) | 303 EXPECT_EQ(1, post_interceptor_->GetHitCount()) |
297 << post_interceptor_->GetRequestsAsString(); | 304 << post_interceptor_->GetRequestsAsString(); |
298 ASSERT_EQ(1, post_interceptor_->GetCount()) | 305 ASSERT_EQ(1, post_interceptor_->GetCount()) |
299 << post_interceptor_->GetRequestsAsString(); | 306 << post_interceptor_->GetRequestsAsString(); |
300 | 307 |
301 // Sanity check the request. | 308 // Sanity check the request. |
302 EXPECT_NE( | 309 EXPECT_NE( |
303 string::npos, | 310 string::npos, |
304 post_interceptor_->GetRequests()[0].find( | 311 post_interceptor_->GetRequests()[0].find( |
305 "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" " | 312 "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" " |
306 "brand=\"TEST\"><updatecheck />" | 313 "brand=\"TEST\"><updatecheck /><ping rd=\"-2\" />" |
307 "<packages><package fp=\"fp1\"/></packages></app>")); | 314 "<packages><package fp=\"fp1\"/></packages></app>")); |
308 | 315 |
309 // Expect an error since the response is not trusted. | 316 // Expect an error since the response is not trusted. |
310 EXPECT_EQ(-10000, error_); | 317 EXPECT_EQ(-10000, error_); |
311 EXPECT_EQ(0ul, results_.list.size()); | 318 EXPECT_EQ(0ul, results_.list.size()); |
312 } | 319 } |
313 | 320 |
314 // Tests that the UpdateCheckers will not make an update check for a | 321 // Tests that the UpdateCheckers will not make an update check for a |
315 // component that requires encryption when the update check URL is unsecure. | 322 // component that requires encryption when the update check URL is unsecure. |
316 TEST_F(UpdateCheckerTest, UpdateCheckRequiresEncryptionError) { | 323 TEST_F(UpdateCheckerTest, UpdateCheckRequiresEncryptionError) { |
317 config_->SetUpdateCheckUrl(GURL("http:\\foo\bar")); | 324 config_->SetUpdateCheckUrl(GURL("http:\\foo\bar")); |
318 | 325 |
319 update_checker_ = UpdateChecker::Create(config_); | 326 update_checker_ = UpdateChecker::Create(config_, metadata_); |
320 | 327 |
321 CrxUpdateItem item(BuildCrxUpdateItem()); | 328 CrxUpdateItem item(BuildCrxUpdateItem()); |
322 item.component.requires_network_encryption = true; | 329 item.component.requires_network_encryption = true; |
323 std::vector<CrxUpdateItem*> items_to_check; | 330 std::vector<CrxUpdateItem*> items_to_check; |
324 items_to_check.push_back(&item); | 331 items_to_check.push_back(&item); |
325 | 332 |
326 update_checker_->CheckForUpdates( | 333 update_checker_->CheckForUpdates( |
327 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, | 334 items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
328 base::Unretained(this))); | 335 base::Unretained(this))); |
329 RunThreads(); | 336 RunThreads(); |
330 | 337 |
331 EXPECT_EQ(-1, error_); | 338 EXPECT_EQ(-1, error_); |
332 EXPECT_EQ(0u, results_.list.size()); | 339 EXPECT_EQ(0u, results_.list.size()); |
333 } | 340 } |
334 | 341 |
| 342 // Tests that the PersistedData will get correctly update and reserialize |
| 343 // the elapsed_days value. |
| 344 TEST_F(UpdateCheckerTest, UpdateCheckDateLastRollCall) { |
| 345 EXPECT_TRUE(post_interceptor_->ExpectRequest( |
| 346 new PartialMatch("updatecheck"), test_file("updatecheck_reply_4.xml"))); |
| 347 EXPECT_TRUE(post_interceptor_->ExpectRequest( |
| 348 new PartialMatch("updatecheck"), test_file("updatecheck_reply_4.xml"))); |
| 349 |
| 350 update_checker_ = UpdateChecker::Create(config_, metadata_); |
| 351 |
| 352 CrxUpdateItem item(BuildCrxUpdateItem()); |
| 353 std::vector<CrxUpdateItem*> items_to_check; |
| 354 items_to_check.push_back(&item); |
| 355 |
| 356 // Do two update-checks. |
| 357 update_checker_->CheckForUpdates( |
| 358 items_to_check, "extra=\"params\"", |
| 359 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
| 360 base::Unretained(this))); |
| 361 RunThreads(); |
| 362 update_checker_ = UpdateChecker::Create(config_, metadata_); |
| 363 update_checker_->CheckForUpdates( |
| 364 items_to_check, "extra=\"params\"", |
| 365 base::Bind(&UpdateCheckerTest::UpdateCheckComplete, |
| 366 base::Unretained(this))); |
| 367 RunThreads(); |
| 368 |
| 369 EXPECT_EQ(2, post_interceptor_->GetHitCount()) |
| 370 << post_interceptor_->GetRequestsAsString(); |
| 371 ASSERT_EQ(2, post_interceptor_->GetCount()) |
| 372 << post_interceptor_->GetRequestsAsString(); |
| 373 EXPECT_NE( |
| 374 string::npos, |
| 375 post_interceptor_->GetRequests()[0].find("<ping rd=\"-2\" />")); |
| 376 EXPECT_NE( |
| 377 string::npos, |
| 378 post_interceptor_->GetRequests()[1].find("<ping rd=\"3383\" />")); |
| 379 } |
| 380 |
335 } // namespace update_client | 381 } // namespace update_client |
OLD | NEW |