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/command_line.h" |
5 #include "base/macros.h" | 6 #include "base/macros.h" |
6 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
8 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 11 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
16 #include "components/autofill/core/browser/autofill_profile.h" | 18 #include "components/autofill/core/browser/autofill_profile.h" |
17 #include "components/autofill/core/browser/autofill_test_utils.h" | 19 #include "components/autofill/core/browser/autofill_test_utils.h" |
18 #include "components/autofill/core/browser/personal_data_manager.h" | 20 #include "components/autofill/core/browser/personal_data_manager.h" |
19 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 21 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
20 #include "components/autofill/core/common/autofill_pref_names.h" | 22 #include "components/autofill/core/common/autofill_pref_names.h" |
21 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
22 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
23 #include "net/url_request/test_url_fetcher_factory.h" | 25 #include "net/url_request/test_url_fetcher_factory.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const std::string expected_upload_data_; | 88 const std::string expected_upload_data_; |
87 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 89 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
88 | 90 |
89 DISALLOW_COPY_AND_ASSIGN(WindowedNetworkObserver); | 91 DISALLOW_COPY_AND_ASSIGN(WindowedNetworkObserver); |
90 }; | 92 }; |
91 | 93 |
92 } // namespace | 94 } // namespace |
93 | 95 |
94 class AutofillServerTest : public InProcessBrowserTest { | 96 class AutofillServerTest : public InProcessBrowserTest { |
95 public: | 97 public: |
| 98 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 99 // Enable finch experiment for sending field metadata. |
| 100 command_line->AppendSwitchASCII( |
| 101 ::switches::kForceFieldTrials, "AutofillFieldMetadata/Enabled/"); |
| 102 } |
| 103 |
96 void SetUpOnMainThread() override { | 104 void SetUpOnMainThread() override { |
97 // Disable interactions with the Mac Keychain. | 105 // Disable interactions with the Mac Keychain. |
98 PrefService* pref_service = browser()->profile()->GetPrefs(); | 106 PrefService* pref_service = browser()->profile()->GetPrefs(); |
99 test::DisableSystemServices(pref_service); | 107 test::DisableSystemServices(pref_service); |
100 | 108 |
101 // Enable uploads, and load a new tab to force the AutofillDownloadManager | 109 // Enable uploads, and load a new tab to force the AutofillDownloadManager |
102 // to update its cached view of the prefs. | 110 // to update its cached view of the prefs. |
103 pref_service->SetDouble(prefs::kAutofillPositiveUploadRate, 1.0); | 111 pref_service->SetDouble(prefs::kAutofillPositiveUploadRate, 1.0); |
104 pref_service->SetDouble(prefs::kAutofillNegativeUploadRate, 1.0); | 112 pref_service->SetDouble(prefs::kAutofillNegativeUploadRate, 1.0); |
105 AddBlankTabAndShow(browser()); | 113 AddBlankTabAndShow(browser()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 "<field signature=\"2750915947\" name=\"two\" type=\"text\"/>" | 202 "<field signature=\"2750915947\" name=\"two\" type=\"text\"/>" |
195 "<field signature=\"116843943\" name=\"three\" type=\"password\"/>" | 203 "<field signature=\"116843943\" name=\"three\" type=\"password\"/>" |
196 "</form></autofillquery>"; | 204 "</form></autofillquery>"; |
197 WindowedNetworkObserver query_network_observer(kQueryRequest); | 205 WindowedNetworkObserver query_network_observer(kQueryRequest); |
198 ui_test_utils::NavigateToURL( | 206 ui_test_utils::NavigateToURL( |
199 browser(), GURL(std::string(kDataURIPrefix) + kFormHtml)); | 207 browser(), GURL(std::string(kDataURIPrefix) + kFormHtml)); |
200 query_network_observer.Wait(); | 208 query_network_observer.Wait(); |
201 } | 209 } |
202 | 210 |
203 } // namespace autofill | 211 } // namespace autofill |
OLD | NEW |