| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <list> | 5 #include <list> |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/autofill/autofill_download.h" | 10 #include "chrome/browser/autofill/autofill_download.h" |
| 11 #include "chrome/browser/autofill/autofill_field.h" | 11 #include "chrome/browser/autofill/autofill_field.h" |
| 12 #include "chrome/browser/autofill/autofill_metrics.h" | 12 #include "chrome/browser/autofill/autofill_metrics.h" |
| 13 #include "chrome/browser/autofill/autofill_type.h" | 13 #include "chrome/browser/autofill/autofill_type.h" |
| 14 #include "chrome/browser/autofill/form_structure.h" | 14 #include "chrome/browser/autofill/form_structure.h" |
| 15 #include "chrome/test/base/test_url_request_context_getter.h" | 15 #include "chrome/test/base/test_url_request_context_getter.h" |
| 16 #include "chrome/test/base/testing_browser_process.h" | 16 #include "chrome/test/base/testing_browser_process.h" |
| 17 #include "chrome/test/base/testing_browser_process_test.h" | |
| 18 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 19 #include "content/test/test_url_fetcher_factory.h" | 18 #include "content/test/test_url_fetcher_factory.h" |
| 20 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 24 #include "webkit/glue/form_data.h" | 23 #include "webkit/glue/form_data.h" |
| 25 | 24 |
| 26 using webkit_glue::FormData; | 25 using webkit_glue::FormData; |
| 27 using webkit_glue::FormField; | 26 using webkit_glue::FormField; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 ResponseData() : type_of_response(REQUEST_QUERY_FAILED), error(0) { | 107 ResponseData() : type_of_response(REQUEST_QUERY_FAILED), error(0) { |
| 109 } | 108 } |
| 110 }; | 109 }; |
| 111 std::list<AutofillDownloadTestHelper::ResponseData> responses_; | 110 std::list<AutofillDownloadTestHelper::ResponseData> responses_; |
| 112 | 111 |
| 113 TestingProfile profile; | 112 TestingProfile profile; |
| 114 AutofillDownloadManager download_manager; | 113 AutofillDownloadManager download_manager; |
| 115 scoped_refptr<net::URLRequestContextGetter> request_context_getter; | 114 scoped_refptr<net::URLRequestContextGetter> request_context_getter; |
| 116 }; | 115 }; |
| 117 | 116 |
| 118 typedef TestingBrowserProcessTest AutofillDownloadTest; | 117 typedef testing::Test AutofillDownloadTest; |
| 119 | 118 |
| 120 TEST_F(AutofillDownloadTest, QueryAndUploadTest) { | 119 TEST_F(AutofillDownloadTest, QueryAndUploadTest) { |
| 121 MessageLoopForUI message_loop; | 120 MessageLoopForUI message_loop; |
| 122 // Create and register factory. | 121 // Create and register factory. |
| 123 AutofillDownloadTestHelper helper; | 122 AutofillDownloadTestHelper helper; |
| 124 TestURLFetcherFactory factory; | 123 TestURLFetcherFactory factory; |
| 125 | 124 |
| 126 FormData form; | 125 FormData form; |
| 127 form.method = ASCIIToUTF16("post"); | 126 form.method = ASCIIToUTF16("post"); |
| 128 | 127 |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 fetcher = factory.GetFetcherByID(3); | 517 fetcher = factory.GetFetcherByID(3); |
| 519 ASSERT_TRUE(fetcher); | 518 ASSERT_TRUE(fetcher); |
| 520 fetcher->delegate()->OnURLFetchComplete(fetcher, GURL(), | 519 fetcher->delegate()->OnURLFetchComplete(fetcher, GURL(), |
| 521 net::URLRequestStatus(), | 520 net::URLRequestStatus(), |
| 522 200, net::ResponseCookies(), | 521 200, net::ResponseCookies(), |
| 523 std::string(responses[0])); | 522 std::string(responses[0])); |
| 524 ASSERT_EQ(static_cast<size_t>(1), helper.responses_.size()); | 523 ASSERT_EQ(static_cast<size_t>(1), helper.responses_.size()); |
| 525 EXPECT_EQ(responses[0], helper.responses_.front().response); | 524 EXPECT_EQ(responses[0], helper.responses_.front().response); |
| 526 } | 525 } |
| 527 | 526 |
| OLD | NEW |