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 "components/autofill/core/browser/autofill_download_manager.h" | 5 #include "components/autofill/core/browser/autofill_download_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <memory> | 10 #include <memory> |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 EXPECT_EQ(0, responses_.front().error); | 270 EXPECT_EQ(0, responses_.front().error); |
271 EXPECT_EQ(std::string(), responses_.front().signature); | 271 EXPECT_EQ(std::string(), responses_.front().signature); |
272 // Expected response on non-query request is an empty string. | 272 // Expected response on non-query request is an empty string. |
273 EXPECT_EQ(std::string(), responses_.front().response); | 273 EXPECT_EQ(std::string(), responses_.front().response); |
274 responses_.pop_front(); | 274 responses_.pop_front(); |
275 | 275 |
276 // Check Request 2. | 276 // Check Request 2. |
277 EXPECT_EQ(AutofillDownloadManagerTest::REQUEST_UPLOAD_FAILED, | 277 EXPECT_EQ(AutofillDownloadManagerTest::REQUEST_UPLOAD_FAILED, |
278 responses_.front().type_of_response); | 278 responses_.front().type_of_response); |
279 EXPECT_EQ(net::HTTP_NOT_FOUND, responses_.front().error); | 279 EXPECT_EQ(net::HTTP_NOT_FOUND, responses_.front().error); |
280 EXPECT_EQ(form_structures[1]->FormSignature(), | 280 EXPECT_EQ(form_structures[1]->FormSignatureAsStr(), |
281 responses_.front().signature); | 281 responses_.front().signature); |
282 // Expected response on non-query request is an empty string. | 282 // Expected response on non-query request is an empty string. |
283 EXPECT_EQ(std::string(), responses_.front().response); | 283 EXPECT_EQ(std::string(), responses_.front().response); |
284 responses_.pop_front(); | 284 responses_.pop_front(); |
285 | 285 |
286 // Check Request 0. | 286 // Check Request 0. |
287 EXPECT_EQ(responses_.front().type_of_response, | 287 EXPECT_EQ(responses_.front().type_of_response, |
288 AutofillDownloadManagerTest::QUERY_SUCCESSFULL); | 288 AutofillDownloadManagerTest::QUERY_SUCCESSFULL); |
289 EXPECT_EQ(0, responses_.front().error); | 289 EXPECT_EQ(0, responses_.front().error); |
290 EXPECT_EQ(std::string(), responses_.front().signature); | 290 EXPECT_EQ(std::string(), responses_.front().signature); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 base::TimeDelta::FromMilliseconds(1100)); | 419 base::TimeDelta::FromMilliseconds(1100)); |
420 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 420 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
421 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 421 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
422 base::TimeDelta::FromMilliseconds(1100)); | 422 base::TimeDelta::FromMilliseconds(1100)); |
423 base::RunLoop().Run(); | 423 base::RunLoop().Run(); |
424 | 424 |
425 // Check that it was a failure. | 425 // Check that it was a failure. |
426 EXPECT_EQ(AutofillDownloadManagerTest::REQUEST_UPLOAD_FAILED, | 426 EXPECT_EQ(AutofillDownloadManagerTest::REQUEST_UPLOAD_FAILED, |
427 responses_.front().type_of_response); | 427 responses_.front().type_of_response); |
428 EXPECT_EQ(net::HTTP_NOT_FOUND, responses_.front().error); | 428 EXPECT_EQ(net::HTTP_NOT_FOUND, responses_.front().error); |
429 EXPECT_EQ(form_structure->FormSignature(), responses_.front().signature); | 429 EXPECT_EQ(form_structure->FormSignatureAsStr(), responses_.front().signature); |
430 // Expected response on non-query request is an empty string. | 430 // Expected response on non-query request is an empty string. |
431 EXPECT_EQ(std::string(), responses_.front().response); | 431 EXPECT_EQ(std::string(), responses_.front().response); |
432 responses_.pop_front(); | 432 responses_.pop_front(); |
433 | 433 |
434 // Get the retried request, and make it successful. | 434 // Get the retried request, and make it successful. |
435 fetcher = factory.GetFetcherByID(1); | 435 fetcher = factory.GetFetcherByID(1); |
436 ASSERT_TRUE(fetcher); | 436 ASSERT_TRUE(fetcher); |
437 FakeOnURLFetchComplete(fetcher, net::HTTP_OK, ""); | 437 FakeOnURLFetchComplete(fetcher, net::HTTP_OK, ""); |
438 | 438 |
439 // Check success of response. | 439 // Check success of response. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 EXPECT_EQ(0U, responses_.size()); | 636 EXPECT_EQ(0U, responses_.size()); |
637 | 637 |
638 fetcher = factory.GetFetcherByID(3); | 638 fetcher = factory.GetFetcherByID(3); |
639 ASSERT_TRUE(fetcher); | 639 ASSERT_TRUE(fetcher); |
640 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); | 640 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); |
641 ASSERT_EQ(1U, responses_.size()); | 641 ASSERT_EQ(1U, responses_.size()); |
642 EXPECT_EQ(responses[0], responses_.front().response); | 642 EXPECT_EQ(responses[0], responses_.front().response); |
643 } | 643 } |
644 | 644 |
645 } // namespace autofill | 645 } // namespace autofill |
OLD | NEW |