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

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

Issue 1141133003: [Autofill] Control using Variations the sending of Autofill field metadata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | components/autofill/core/browser/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698