| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/autofill/autofill_common_test.h" | 12 #include "chrome/browser/autofill/autofill_common_test.h" |
| 13 #include "chrome/browser/autofill/autofill_profile.h" | 13 #include "chrome/browser/autofill/autofill_profile.h" |
| 14 #include "chrome/browser/autofill/personal_data_manager.h" | 14 #include "chrome/browser/autofill/personal_data_manager.h" |
| 15 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 15 #include "chrome/browser/infobars/infobar_tab_helper.h" | 16 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/translate/translate_infobar_delegate.h" | 18 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| 18 #include "chrome/browser/translate/translate_manager.h" | 19 #include "chrome/browser/translate/translate_manager.h" |
| 19 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
| 24 #include "chrome/renderer/translate_helper.h" | 25 #include "chrome/renderer/translate_helper.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void CreateTestProfile() { | 74 void CreateTestProfile() { |
| 74 autofill_test::DisableSystemServices(browser()->profile()); | 75 autofill_test::DisableSystemServices(browser()->profile()); |
| 75 | 76 |
| 76 AutofillProfile profile; | 77 AutofillProfile profile; |
| 77 autofill_test::SetProfileInfo( | 78 autofill_test::SetProfileInfo( |
| 78 &profile, "Milton", "C.", "Waddams", | 79 &profile, "Milton", "C.", "Waddams", |
| 79 "red.swingline@initech.com", "Initech", "4120 Freidrich Lane", | 80 "red.swingline@initech.com", "Initech", "4120 Freidrich Lane", |
| 80 "Basement", "Austin", "Texas", "78744", "United States", "5125551234"); | 81 "Basement", "Austin", "Texas", "78744", "United States", "5125551234"); |
| 81 | 82 |
| 82 PersonalDataManager* personal_data_manager = | 83 PersonalDataManager* personal_data_manager = |
| 83 browser()->profile()->GetPersonalDataManager(); | 84 PersonalDataManagerFactory::GetForProfile(browser()->profile()); |
| 84 ASSERT_TRUE(personal_data_manager); | 85 ASSERT_TRUE(personal_data_manager); |
| 85 | 86 |
| 86 personal_data_manager->AddProfile(profile); | 87 personal_data_manager->AddProfile(profile); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void ExpectFieldValue(const std::wstring& field_name, | 90 void ExpectFieldValue(const std::wstring& field_name, |
| 90 const std::string& expected_value) { | 91 const std::string& expected_value) { |
| 91 std::string value; | 92 std::string value; |
| 92 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 93 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
| 93 browser()->GetSelectedTabContents()->render_view_host(), L"", | 94 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 // Once click the text field, it starts again. | 616 // Once click the text field, it starts again. |
| 616 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 617 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
| 617 render_view_host(), L"", | 618 render_view_host(), L"", |
| 618 L"cr.googleTranslate.onTranslateElementLoad();")); | 619 L"cr.googleTranslate.onTranslateElementLoad();")); |
| 619 | 620 |
| 620 // Simulate the render notifying the translation has been done. | 621 // Simulate the render notifying the translation has been done. |
| 621 ui_test_utils::WaitForNotification(chrome::NOTIFICATION_PAGE_TRANSLATED); | 622 ui_test_utils::WaitForNotification(chrome::NOTIFICATION_PAGE_TRANSLATED); |
| 622 | 623 |
| 623 TryBasicFormFill(); | 624 TryBasicFormFill(); |
| 624 } | 625 } |
| OLD | NEW |