| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "app/keyboard_code_conversion.h" | 8 #include "app/keyboard_code_conversion.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/browser/autofill/autofill_common_test.h" | 13 #include "chrome/browser/autofill/autofill_common_test.h" |
| 14 #include "chrome/browser/autofill/autofill_profile.h" | 14 #include "chrome/browser/autofill/autofill_profile.h" |
| 15 #include "chrome/browser/autofill/personal_data_manager.h" | 15 #include "chrome/browser/autofill/personal_data_manager.h" |
| 16 #include "chrome/browser/net/predictor_api.h" | 16 #include "chrome/browser/net/predictor_api.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/renderer_host/mock_render_process_host.h" | 18 #include "chrome/browser/renderer_host/mock_render_process_host.h" |
| 19 #include "chrome/browser/renderer_host/render_view_host.h" | 19 #include "chrome/browser/renderer_host/render_view_host.h" |
| 20 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" |
| 21 #include "chrome/browser/translate/translate_infobar_delegate.h" | 21 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| 22 #include "chrome/browser/translate/translate_manager.h" | 22 #include "chrome/browser/translate/translate_manager.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 25 #include "chrome/common/net/test_url_fetcher_factory.h" | 25 #include "chrome/common/net/test_url_fetcher_factory.h" |
| 26 #include "chrome/common/pref_names.h" | |
| 27 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
| 28 #include "chrome/renderer/translate_helper.h" | 27 #include "chrome/renderer/translate_helper.h" |
| 29 #include "chrome/test/in_process_browser_test.h" | 28 #include "chrome/test/in_process_browser_test.h" |
| 30 #include "chrome/test/ui_test_utils.h" | 29 #include "chrome/test/ui_test_utils.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 32 | 31 |
| 33 static const char* kTestFormString = | 32 static const char* kTestFormString = |
| 34 "<form action=\"http://www.google.com/\" method=\"POST\">" | 33 "<form action=\"http://www.google.com/\" method=\"POST\">" |
| 35 "<label for=\"firstname\">First name:</label>" | 34 "<label for=\"firstname\">First name:</label>" |
| 36 " <input type=\"text\" id=\"firstname\"" | 35 " <input type=\"text\" id=\"firstname\"" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // The form should be filled. | 190 // The form should be filled. |
| 192 ExpectFieldValue(L"firstname", "Milton"); | 191 ExpectFieldValue(L"firstname", "Milton"); |
| 193 ExpectFieldValue(L"lastname", "Waddams"); | 192 ExpectFieldValue(L"lastname", "Waddams"); |
| 194 ExpectFieldValue(L"address1", "4120 Freidrich Lane"); | 193 ExpectFieldValue(L"address1", "4120 Freidrich Lane"); |
| 195 ExpectFieldValue(L"address2", "Basement"); | 194 ExpectFieldValue(L"address2", "Basement"); |
| 196 ExpectFieldValue(L"city", "Austin"); | 195 ExpectFieldValue(L"city", "Austin"); |
| 197 ExpectFieldValue(L"state", "TX"); | 196 ExpectFieldValue(L"state", "TX"); |
| 198 ExpectFieldValue(L"zip", "78744"); | 197 ExpectFieldValue(L"zip", "78744"); |
| 199 ExpectFieldValue(L"country", "US"); | 198 ExpectFieldValue(L"country", "US"); |
| 200 ExpectFieldValue(L"phone", "5125551234"); | 199 ExpectFieldValue(L"phone", "5125551234"); |
| 201 | |
| 202 } | 200 } |
| 203 | 201 |
| 204 private: | 202 private: |
| 205 TestURLFetcherFactory url_fetcher_factory_; | 203 TestURLFetcherFactory url_fetcher_factory_; |
| 206 }; | 204 }; |
| 207 | 205 |
| 208 // Test that basic form fill is working. | 206 // Test that basic form fill is working. |
| 209 IN_PROC_BROWSER_TEST_F(AutoFillTest, BasicFormFill) { | 207 IN_PROC_BROWSER_TEST_F(AutoFillTest, BasicFormFill) { |
| 210 SetUpProfile(); | 208 SetUpProfile(); |
| 211 | 209 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // But right now, the call stucks here. | 275 // But right now, the call stucks here. |
| 278 // Once click the text field, it starts again. | 276 // Once click the text field, it starts again. |
| 279 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 277 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
| 280 rvh(), L"", L"cr.googleTranslate.onTranslateElementLoad();")); | 278 rvh(), L"", L"cr.googleTranslate.onTranslateElementLoad();")); |
| 281 | 279 |
| 282 // Simulate the render notifying the translation has been done. | 280 // Simulate the render notifying the translation has been done. |
| 283 ui_test_utils::WaitForNotification(NotificationType::PAGE_TRANSLATED); | 281 ui_test_utils::WaitForNotification(NotificationType::PAGE_TRANSLATED); |
| 284 | 282 |
| 285 TryBasicFormFillWithMKey(); | 283 TryBasicFormFillWithMKey(); |
| 286 } | 284 } |
| OLD | NEW |