Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: chrome/browser/autofill/autofill_download_unittest.cc

Issue 11000016: Move forms/ out of webkit/. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to review Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/autofill/autofill_download.h" 11 #include "chrome/browser/autofill/autofill_download.h"
12 #include "chrome/browser/autofill/autofill_field.h" 12 #include "chrome/browser/autofill/autofill_field.h"
13 #include "chrome/browser/autofill/autofill_metrics.h" 13 #include "chrome/browser/autofill/autofill_metrics.h"
14 #include "chrome/browser/autofill/autofill_type.h" 14 #include "chrome/browser/autofill/autofill_type.h"
15 #include "chrome/browser/autofill/form_structure.h" 15 #include "chrome/browser/autofill/form_structure.h"
16 #include "chrome/common/form_data.h"
16 #include "chrome/test/base/testing_browser_process.h" 17 #include "chrome/test/base/testing_browser_process.h"
17 #include "chrome/test/base/testing_profile.h" 18 #include "chrome/test/base/testing_profile.h"
18 #include "content/public/test/test_browser_thread.h" 19 #include "content/public/test/test_browser_thread.h"
19 #include "net/url_request/test_url_fetcher_factory.h" 20 #include "net/url_request/test_url_fetcher_factory.h"
20 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
24 #include "webkit/forms/form_data.h"
25 25
26 using content::BrowserThread; 26 using content::BrowserThread;
27 using webkit::forms::FormData;
28 using webkit::forms::FormField;
29 using WebKit::WebInputElement; 27 using WebKit::WebInputElement;
30 28
31 namespace { 29 namespace {
32 30
33 class MockAutofillMetrics : public AutofillMetrics { 31 class MockAutofillMetrics : public AutofillMetrics {
34 public: 32 public:
35 MockAutofillMetrics() {} 33 MockAutofillMetrics() {}
36 MOCK_CONST_METHOD1(LogServerQueryMetric, void(ServerQueryMetric metric)); 34 MOCK_CONST_METHOD1(LogServerQueryMetric, void(ServerQueryMetric metric));
37 35
38 private: 36 private:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 }; 136 };
139 137
140 TEST_F(AutofillDownloadTest, QueryAndUploadTest) { 138 TEST_F(AutofillDownloadTest, QueryAndUploadTest) {
141 MessageLoopForUI message_loop; 139 MessageLoopForUI message_loop;
142 // Create and register factory. 140 // Create and register factory.
143 net::TestURLFetcherFactory factory; 141 net::TestURLFetcherFactory factory;
144 142
145 FormData form; 143 FormData form;
146 form.method = ASCIIToUTF16("post"); 144 form.method = ASCIIToUTF16("post");
147 145
148 FormField field; 146 FormFieldData field;
149 field.label = ASCIIToUTF16("username"); 147 field.label = ASCIIToUTF16("username");
150 field.name = ASCIIToUTF16("username"); 148 field.name = ASCIIToUTF16("username");
151 field.form_control_type = ASCIIToUTF16("text"); 149 field.form_control_type = ASCIIToUTF16("text");
152 form.fields.push_back(field); 150 form.fields.push_back(field);
153 151
154 field.label = ASCIIToUTF16("First Name"); 152 field.label = ASCIIToUTF16("First Name");
155 field.name = ASCIIToUTF16("firstname"); 153 field.name = ASCIIToUTF16("firstname");
156 field.form_control_type = ASCIIToUTF16("text"); 154 field.form_control_type = ASCIIToUTF16("text");
157 form.fields.push_back(field); 155 form.fields.push_back(field);
158 156
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 348 }
351 349
352 TEST_F(AutofillDownloadTest, CacheQueryTest) { 350 TEST_F(AutofillDownloadTest, CacheQueryTest) {
353 MessageLoopForUI message_loop; 351 MessageLoopForUI message_loop;
354 // Create and register factory. 352 // Create and register factory.
355 net::TestURLFetcherFactory factory; 353 net::TestURLFetcherFactory factory;
356 354
357 FormData form; 355 FormData form;
358 form.method = ASCIIToUTF16("post"); 356 form.method = ASCIIToUTF16("post");
359 357
360 FormField field; 358 FormFieldData field;
361 field.form_control_type = ASCIIToUTF16("text"); 359 field.form_control_type = ASCIIToUTF16("text");
362 360
363 field.label = ASCIIToUTF16("username"); 361 field.label = ASCIIToUTF16("username");
364 field.name = ASCIIToUTF16("username"); 362 field.name = ASCIIToUTF16("username");
365 form.fields.push_back(field); 363 form.fields.push_back(field);
366 364
367 field.label = ASCIIToUTF16("First Name"); 365 field.label = ASCIIToUTF16("First Name");
368 field.name = ASCIIToUTF16("firstname"); 366 field.name = ASCIIToUTF16("firstname");
369 form.fields.push_back(field); 367 form.fields.push_back(field);
370 368
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 mock_metric_logger)); 496 mock_metric_logger));
499 // No responses yet 497 // No responses yet
500 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); 498 EXPECT_EQ(static_cast<size_t>(0), responses_.size());
501 499
502 fetcher = factory.GetFetcherByID(3); 500 fetcher = factory.GetFetcherByID(3);
503 ASSERT_TRUE(fetcher); 501 ASSERT_TRUE(fetcher);
504 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); 502 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0]));
505 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); 503 ASSERT_EQ(static_cast<size_t>(1), responses_.size());
506 EXPECT_EQ(responses[0], responses_.front().response); 504 EXPECT_EQ(responses[0], responses_.front().response);
507 } 505 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_common_test.cc ('k') | chrome/browser/autofill/autofill_external_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698