| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 18 #include "chrome/browser/autofill/autofill_uitest_util.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/infobars/infobar_service.h" | 20 #include "chrome/browser/infobars/infobar_service.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/translate/chrome_translate_client.h" | 22 #include "chrome/browser/translate/chrome_translate_client.h" |
| 23 #include "chrome/browser/translate/translate_service.h" | 23 #include "chrome/browser/translate/translate_service.h" |
| 24 #include "chrome/browser/ui/browser.h" | |
| 25 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 25 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 27 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
| 28 #include "chrome/test/base/in_process_browser_test.h" | 27 #include "chrome/test/base/in_process_browser_test.h" |
| 29 #include "chrome/test/base/interactive_test_utils.h" | 28 #include "chrome/test/base/interactive_test_utils.h" |
| 30 #include "chrome/test/base/test_switches.h" | 29 #include "chrome/test/base/test_switches.h" |
| 31 #include "chrome/test/base/ui_test_utils.h" | 30 #include "chrome/test/base/ui_test_utils.h" |
| 32 #include "components/autofill/content/browser/content_autofill_driver.h" | 31 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 33 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 32 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 34 #include "components/autofill/core/browser/autofill_manager.h" | 33 #include "components/autofill/core/browser/autofill_manager.h" |
| 35 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" | 34 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" |
| 36 #include "components/autofill/core/browser/autofill_profile.h" | 35 #include "components/autofill/core/browser/autofill_profile.h" |
| 37 #include "components/autofill/core/browser/autofill_test_utils.h" | 36 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 38 #include "components/autofill/core/browser/personal_data_manager.h" | |
| 39 #include "components/autofill/core/browser/personal_data_manager_observer.h" | |
| 40 #include "components/autofill/core/browser/validation.h" | 37 #include "components/autofill/core/browser/validation.h" |
| 41 #include "components/infobars/core/confirm_infobar_delegate.h" | |
| 42 #include "components/infobars/core/infobar.h" | 38 #include "components/infobars/core/infobar.h" |
| 43 #include "components/infobars/core/infobar_manager.h" | |
| 44 #include "components/translate/core/browser/translate_infobar_delegate.h" | 39 #include "components/translate/core/browser/translate_infobar_delegate.h" |
| 45 #include "content/public/browser/navigation_controller.h" | 40 #include "content/public/browser/navigation_controller.h" |
| 46 #include "content/public/browser/notification_observer.h" | 41 #include "content/public/browser/notification_observer.h" |
| 47 #include "content/public/browser/notification_registrar.h" | 42 #include "content/public/browser/notification_registrar.h" |
| 48 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
| 49 #include "content/public/browser/render_view_host.h" | 44 #include "content/public/browser/render_view_host.h" |
| 50 #include "content/public/browser/render_widget_host.h" | 45 #include "content/public/browser/render_widget_host.h" |
| 51 #include "content/public/browser/web_contents.h" | 46 #include "content/public/browser/web_contents.h" |
| 52 #include "content/public/test/browser_test_utils.h" | 47 #include "content/public/test/browser_test_utils.h" |
| 53 #include "content/public/test/test_renderer_host.h" | 48 #include "content/public/test/test_renderer_host.h" |
| 54 #include "content/public/test/test_utils.h" | |
| 55 #include "net/url_request/test_url_fetcher_factory.h" | 49 #include "net/url_request/test_url_fetcher_factory.h" |
| 56 #include "testing/gmock/include/gmock/gmock.h" | 50 #include "testing/gmock/include/gmock/gmock.h" |
| 57 #include "testing/gtest/include/gtest/gtest.h" | 51 #include "testing/gtest/include/gtest/gtest.h" |
| 58 #include "ui/events/keycodes/keyboard_codes.h" | 52 #include "ui/events/keycodes/keyboard_codes.h" |
| 59 | 53 |
| 60 using base::ASCIIToUTF16; | 54 using base::ASCIIToUTF16; |
| 61 | 55 |
| 62 namespace autofill { | 56 namespace autofill { |
| 63 | 57 |
| 64 static const char kDataURIPrefix[] = "data:text/html;charset=utf-8,"; | 58 static const char kDataURIPrefix[] = "data:text/html;charset=utf-8,"; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void Wait() { | 119 void Wait() { |
| 126 loop_runner_->Run(); | 120 loop_runner_->Run(); |
| 127 } | 121 } |
| 128 | 122 |
| 129 private: | 123 private: |
| 130 scoped_refptr<content::MessageLoopRunner> loop_runner_; | 124 scoped_refptr<content::MessageLoopRunner> loop_runner_; |
| 131 | 125 |
| 132 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTestDelegateImpl); | 126 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTestDelegateImpl); |
| 133 }; | 127 }; |
| 134 | 128 |
| 135 | |
| 136 // WindowedPersonalDataManagerObserver ---------------------------------------- | |
| 137 | |
| 138 class WindowedPersonalDataManagerObserver | |
| 139 : public PersonalDataManagerObserver, | |
| 140 public infobars::InfoBarManager::Observer { | |
| 141 public: | |
| 142 explicit WindowedPersonalDataManagerObserver(Browser* browser) | |
| 143 : alerted_(false), | |
| 144 has_run_message_loop_(false), | |
| 145 browser_(browser), | |
| 146 infobar_service_(InfoBarService::FromWebContents( | |
| 147 browser_->tab_strip_model()->GetActiveWebContents())) { | |
| 148 PersonalDataManagerFactory::GetForProfile(browser_->profile())-> | |
| 149 AddObserver(this); | |
| 150 infobar_service_->AddObserver(this); | |
| 151 } | |
| 152 | |
| 153 ~WindowedPersonalDataManagerObserver() override { | |
| 154 while (infobar_service_->infobar_count() > 0) { | |
| 155 infobar_service_->RemoveInfoBar(infobar_service_->infobar_at(0)); | |
| 156 } | |
| 157 infobar_service_->RemoveObserver(this); | |
| 158 } | |
| 159 | |
| 160 // PersonalDataManagerObserver: | |
| 161 void OnPersonalDataChanged() override { | |
| 162 if (has_run_message_loop_) { | |
| 163 base::MessageLoopForUI::current()->Quit(); | |
| 164 has_run_message_loop_ = false; | |
| 165 } | |
| 166 alerted_ = true; | |
| 167 } | |
| 168 | |
| 169 void OnInsufficientFormData() override { OnPersonalDataChanged(); } | |
| 170 | |
| 171 | |
| 172 void Wait() { | |
| 173 if (!alerted_) { | |
| 174 has_run_message_loop_ = true; | |
| 175 content::RunMessageLoop(); | |
| 176 } | |
| 177 PersonalDataManagerFactory::GetForProfile(browser_->profile())-> | |
| 178 RemoveObserver(this); | |
| 179 } | |
| 180 | |
| 181 private: | |
| 182 // infobars::InfoBarManager::Observer: | |
| 183 void OnInfoBarAdded(infobars::InfoBar* infobar) override { | |
| 184 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate()-> | |
| 185 Accept(); | |
| 186 } | |
| 187 | |
| 188 bool alerted_; | |
| 189 bool has_run_message_loop_; | |
| 190 Browser* browser_; | |
| 191 InfoBarService* infobar_service_; | |
| 192 | |
| 193 DISALLOW_COPY_AND_ASSIGN(WindowedPersonalDataManagerObserver); | |
| 194 }; | |
| 195 | |
| 196 // AutofillInteractiveTest ---------------------------------------------------- | 129 // AutofillInteractiveTest ---------------------------------------------------- |
| 197 | 130 |
| 198 class AutofillInteractiveTest : public InProcessBrowserTest { | 131 class AutofillInteractiveTest : public InProcessBrowserTest { |
| 199 protected: | 132 protected: |
| 200 AutofillInteractiveTest() : | 133 AutofillInteractiveTest() : |
| 201 key_press_event_sink_( | 134 key_press_event_sink_( |
| 202 base::Bind(&AutofillInteractiveTest::HandleKeyPressEvent, | 135 base::Bind(&AutofillInteractiveTest::HandleKeyPressEvent, |
| 203 base::Unretained(this))) {} | 136 base::Unretained(this))) {} |
| 204 ~AutofillInteractiveTest() override {} | 137 ~AutofillInteractiveTest() override {} |
| 205 | 138 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 227 void TearDownOnMainThread() override { | 160 void TearDownOnMainThread() override { |
| 228 // Make sure to close any showing popups prior to tearing down the UI. | 161 // Make sure to close any showing popups prior to tearing down the UI. |
| 229 content::WebContents* web_contents = GetWebContents(); | 162 content::WebContents* web_contents = GetWebContents(); |
| 230 AutofillManager* autofill_manager = | 163 AutofillManager* autofill_manager = |
| 231 ContentAutofillDriverFactory::FromWebContents(web_contents) | 164 ContentAutofillDriverFactory::FromWebContents(web_contents) |
| 232 ->DriverForFrame(web_contents->GetMainFrame()) | 165 ->DriverForFrame(web_contents->GetMainFrame()) |
| 233 ->autofill_manager(); | 166 ->autofill_manager(); |
| 234 autofill_manager->client()->HideAutofillPopup(); | 167 autofill_manager->client()->HideAutofillPopup(); |
| 235 } | 168 } |
| 236 | 169 |
| 237 PersonalDataManager* GetPersonalDataManager() { | |
| 238 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); | |
| 239 } | |
| 240 | |
| 241 content::WebContents* GetWebContents() { | 170 content::WebContents* GetWebContents() { |
| 242 return browser()->tab_strip_model()->GetActiveWebContents(); | 171 return browser()->tab_strip_model()->GetActiveWebContents(); |
| 243 } | 172 } |
| 244 | 173 |
| 245 content::RenderViewHost* GetRenderViewHost() { | 174 content::RenderViewHost* GetRenderViewHost() { |
| 246 return GetWebContents()->GetRenderViewHost(); | 175 return GetWebContents()->GetRenderViewHost(); |
| 247 } | 176 } |
| 248 | 177 |
| 249 void CreateTestProfile() { | 178 void CreateTestProfile() { |
| 250 AutofillProfile profile; | 179 AutofillProfile profile; |
| 251 test::SetProfileInfo( | 180 test::SetProfileInfo( |
| 252 &profile, "Milton", "C.", "Waddams", | 181 &profile, "Milton", "C.", "Waddams", |
| 253 "red.swingline@initech.com", "Initech", "4120 Freidrich Lane", | 182 "red.swingline@initech.com", "Initech", "4120 Freidrich Lane", |
| 254 "Basement", "Austin", "Texas", "78744", "US", "5125551234"); | 183 "Basement", "Austin", "Texas", "78744", "US", "5125551234"); |
| 255 | 184 |
| 256 WindowedPersonalDataManagerObserver observer(browser()); | 185 AddTestProfile(browser(), profile); |
| 257 GetPersonalDataManager()->AddProfile(profile); | |
| 258 | |
| 259 // AddProfile is asynchronous. Wait for it to finish before continuing the | |
| 260 // tests. | |
| 261 observer.Wait(); | |
| 262 } | |
| 263 | |
| 264 void SetProfiles(std::vector<AutofillProfile>* profiles) { | |
| 265 WindowedPersonalDataManagerObserver observer(browser()); | |
| 266 GetPersonalDataManager()->SetProfiles(profiles); | |
| 267 observer.Wait(); | |
| 268 } | |
| 269 | |
| 270 void SetProfile(const AutofillProfile& profile) { | |
| 271 std::vector<AutofillProfile> profiles; | |
| 272 profiles.push_back(profile); | |
| 273 SetProfiles(&profiles); | |
| 274 } | 186 } |
| 275 | 187 |
| 276 // Populates a webpage form using autofill data and keypress events. | 188 // Populates a webpage form using autofill data and keypress events. |
| 277 // This function focuses the specified input field in the form, and then | 189 // This function focuses the specified input field in the form, and then |
| 278 // sends keypress events to the tab to cause the form to be populated. | 190 // sends keypress events to the tab to cause the form to be populated. |
| 279 void PopulateForm(const std::string& field_id) { | 191 void PopulateForm(const std::string& field_id) { |
| 280 std::string js("document.getElementById('" + field_id + "').focus();"); | 192 std::string js("document.getElementById('" + field_id + "').focus();"); |
| 281 ASSERT_TRUE(content::ExecuteScript(GetRenderViewHost(), js)); | 193 ASSERT_TRUE(content::ExecuteScript(GetRenderViewHost(), js)); |
| 282 | 194 |
| 283 SendKeyToPageAndWait(ui::VKEY_DOWN); | 195 SendKeyToPageAndWait(ui::VKEY_DOWN); |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 ASSERT_TRUE(test_server()->Start()); | 1141 ASSERT_TRUE(test_server()->Start()); |
| 1230 | 1142 |
| 1231 AutofillProfile profile; | 1143 AutofillProfile profile; |
| 1232 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 1144 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
| 1233 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 1145 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
| 1234 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 H St.")); | 1146 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 H St.")); |
| 1235 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); | 1147 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); |
| 1236 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); | 1148 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); |
| 1237 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); | 1149 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); |
| 1238 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("1-408-555-4567")); | 1150 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("1-408-555-4567")); |
| 1239 SetProfile(profile); | 1151 SetTestProfile(browser(), profile); |
| 1240 | 1152 |
| 1241 GURL url = test_server()->GetURL("files/autofill/form_phones.html"); | 1153 GURL url = test_server()->GetURL("files/autofill/form_phones.html"); |
| 1242 ui_test_utils::NavigateToURL(browser(), url); | 1154 ui_test_utils::NavigateToURL(browser(), url); |
| 1243 PopulateForm("NAME_FIRST"); | 1155 PopulateForm("NAME_FIRST"); |
| 1244 | 1156 |
| 1245 ExpectFieldValue("NAME_FIRST", "Bob"); | 1157 ExpectFieldValue("NAME_FIRST", "Bob"); |
| 1246 ExpectFieldValue("NAME_LAST", "Smith"); | 1158 ExpectFieldValue("NAME_LAST", "Smith"); |
| 1247 ExpectFieldValue("ADDRESS_HOME_LINE1", "1234 H St."); | 1159 ExpectFieldValue("ADDRESS_HOME_LINE1", "1234 H St."); |
| 1248 ExpectFieldValue("ADDRESS_HOME_CITY", "San Jose"); | 1160 ExpectFieldValue("ADDRESS_HOME_CITY", "San Jose"); |
| 1249 ExpectFieldValue("ADDRESS_HOME_STATE", "CA"); | 1161 ExpectFieldValue("ADDRESS_HOME_STATE", "CA"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1270 AutofillProfile profile; | 1182 AutofillProfile profile; |
| 1271 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 1183 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
| 1272 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 1184 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
| 1273 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("bsmith@gmail.com")); | 1185 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("bsmith@gmail.com")); |
| 1274 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16(addr_line1)); | 1186 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16(addr_line1)); |
| 1275 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); | 1187 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); |
| 1276 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); | 1188 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); |
| 1277 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); | 1189 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); |
| 1278 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); | 1190 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); |
| 1279 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("408-871-4567")); | 1191 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("408-871-4567")); |
| 1280 SetProfile(profile); | 1192 SetTestProfile(browser(), profile); |
| 1281 | 1193 |
| 1282 GURL url = test_server()->GetURL("files/autofill/read_only_field_test.html"); | 1194 GURL url = test_server()->GetURL("files/autofill/read_only_field_test.html"); |
| 1283 ui_test_utils::NavigateToURL(browser(), url); | 1195 ui_test_utils::NavigateToURL(browser(), url); |
| 1284 PopulateForm("firstname"); | 1196 PopulateForm("firstname"); |
| 1285 | 1197 |
| 1286 ExpectFieldValue("email", std::string()); | 1198 ExpectFieldValue("email", std::string()); |
| 1287 ExpectFieldValue("address", addr_line1); | 1199 ExpectFieldValue("address", addr_line1); |
| 1288 } | 1200 } |
| 1289 | 1201 |
| 1290 // Test form is fillable from a profile after form was reset. | 1202 // Test form is fillable from a profile after form was reset. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 DISABLED_MultipleEmailFilledByOneUserGesture) { | 1253 DISABLED_MultipleEmailFilledByOneUserGesture) { |
| 1342 ASSERT_TRUE(test_server()->Start()); | 1254 ASSERT_TRUE(test_server()->Start()); |
| 1343 | 1255 |
| 1344 std::string email("bsmith@gmail.com"); | 1256 std::string email("bsmith@gmail.com"); |
| 1345 | 1257 |
| 1346 AutofillProfile profile; | 1258 AutofillProfile profile; |
| 1347 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 1259 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
| 1348 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 1260 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
| 1349 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16(email)); | 1261 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16(email)); |
| 1350 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("4088714567")); | 1262 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("4088714567")); |
| 1351 SetProfile(profile); | 1263 SetTestProfile(browser(), profile); |
| 1352 | 1264 |
| 1353 GURL url = test_server()->GetURL( | 1265 GURL url = test_server()->GetURL( |
| 1354 "files/autofill/autofill_confirmemail_form.html"); | 1266 "files/autofill/autofill_confirmemail_form.html"); |
| 1355 ui_test_utils::NavigateToURL(browser(), url); | 1267 ui_test_utils::NavigateToURL(browser(), url); |
| 1356 PopulateForm("NAME_FIRST"); | 1268 PopulateForm("NAME_FIRST"); |
| 1357 | 1269 |
| 1358 ExpectFieldValue("EMAIL_CONFIRM", email); | 1270 ExpectFieldValue("EMAIL_CONFIRM", email); |
| 1359 // TODO(isherman): verify entire form. | 1271 // TODO(isherman): verify entire form. |
| 1360 } | 1272 } |
| 1361 | 1273 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 base::string16 zip(base::IntToString16(base::RandInt(0, 10000))); | 1312 base::string16 zip(base::IntToString16(base::RandInt(0, 10000))); |
| 1401 profile.SetRawInfo(NAME_FIRST, name); | 1313 profile.SetRawInfo(NAME_FIRST, name); |
| 1402 profile.SetRawInfo(EMAIL_ADDRESS, email); | 1314 profile.SetRawInfo(EMAIL_ADDRESS, email); |
| 1403 profile.SetRawInfo(ADDRESS_HOME_LINE1, street); | 1315 profile.SetRawInfo(ADDRESS_HOME_LINE1, street); |
| 1404 profile.SetRawInfo(ADDRESS_HOME_CITY, city); | 1316 profile.SetRawInfo(ADDRESS_HOME_CITY, city); |
| 1405 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); | 1317 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); |
| 1406 profile.SetRawInfo(ADDRESS_HOME_ZIP, zip); | 1318 profile.SetRawInfo(ADDRESS_HOME_ZIP, zip); |
| 1407 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); | 1319 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); |
| 1408 profiles.push_back(profile); | 1320 profiles.push_back(profile); |
| 1409 } | 1321 } |
| 1410 SetProfiles(&profiles); | 1322 SetTestProfiles(browser(), &profiles); |
| 1411 // TODO(isherman): once we're sure this test doesn't timeout on any bots, this | 1323 // TODO(isherman): once we're sure this test doesn't timeout on any bots, this |
| 1412 // can be removd. | 1324 // can be removd. |
| 1413 LOG(INFO) << "Created " << kNumProfiles << " profiles in " << | 1325 LOG(INFO) << "Created " << kNumProfiles << " profiles in " << |
| 1414 (base::Time::Now() - start_time).InSeconds() << " seconds."; | 1326 (base::Time::Now() - start_time).InSeconds() << " seconds."; |
| 1415 | 1327 |
| 1416 GURL url = test_server()->GetURL( | 1328 GURL url = test_server()->GetURL( |
| 1417 "files/autofill/latency_after_submit_test.html"); | 1329 "files/autofill/latency_after_submit_test.html"); |
| 1418 ui_test_utils::NavigateToURL(browser(), url); | 1330 ui_test_utils::NavigateToURL(browser(), url); |
| 1419 PopulateForm("NAME_FIRST"); | 1331 PopulateForm("NAME_FIRST"); |
| 1420 | 1332 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1451 ASSERT_TRUE(content::ExecuteScript( | 1363 ASSERT_TRUE(content::ExecuteScript( |
| 1452 GetRenderViewHost(), | 1364 GetRenderViewHost(), |
| 1453 "document.querySelector('input').autocomplete = 'off';")); | 1365 "document.querySelector('input').autocomplete = 'off';")); |
| 1454 | 1366 |
| 1455 // Press the down arrow to select the suggestion and attempt to preview the | 1367 // Press the down arrow to select the suggestion and attempt to preview the |
| 1456 // autofilled form. | 1368 // autofilled form. |
| 1457 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 1369 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
| 1458 } | 1370 } |
| 1459 | 1371 |
| 1460 } // namespace autofill | 1372 } // namespace autofill |
| OLD | NEW |