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" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 LOG(WARNING) << "Clicking on the tab."; | 148 LOG(WARNING) << "Clicking on the tab."; |
149 ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), | 149 ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), |
150 VIEW_ID_TAB_CONTAINER)); | 150 VIEW_ID_TAB_CONTAINER)); |
151 ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), | 151 ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), |
152 VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 152 VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
153 | 153 |
154 LOG(WARNING) << "Focusing the first name field."; | 154 LOG(WARNING) << "Focusing the first name field."; |
155 bool result = false; | 155 bool result = false; |
156 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 156 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
157 render_view_host(), L"", | 157 render_view_host(), L"", |
158 L"document.getElementById('firstname').focus();", &result)); | 158 L"if (document.readyState === 'complete')" |
159 L" document.getElementById('firstname').focus();" | |
160 L"else" | |
161 L" domAutomationController.send(false);", | |
162 &result)); | |
159 ASSERT_TRUE(result); | 163 ASSERT_TRUE(result); |
160 } | 164 } |
161 | 165 |
162 void ExpectFilledTestForm() { | 166 void ExpectFilledTestForm() { |
163 ExpectFieldValue(L"firstname", "Milton"); | 167 ExpectFieldValue(L"firstname", "Milton"); |
164 ExpectFieldValue(L"lastname", "Waddams"); | 168 ExpectFieldValue(L"lastname", "Waddams"); |
165 ExpectFieldValue(L"address1", "4120 Freidrich Lane"); | 169 ExpectFieldValue(L"address1", "4120 Freidrich Lane"); |
166 ExpectFieldValue(L"address2", "Basement"); | 170 ExpectFieldValue(L"address2", "Basement"); |
167 ExpectFieldValue(L"city", "Austin"); | 171 ExpectFieldValue(L"city", "Austin"); |
168 ExpectFieldValue(L"state", "TX"); | 172 ExpectFieldValue(L"state", "TX"); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), GURL(kURL))); | 381 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), GURL(kURL))); |
378 | 382 |
379 // Invoke Autofill. | 383 // Invoke Autofill. |
380 TryBasicFormFill(); | 384 TryBasicFormFill(); |
381 } | 385 } |
382 | 386 |
383 // Test that form filling works after reloading the current page. | 387 // Test that form filling works after reloading the current page. |
384 // This test brought to you by http://crbug.com/69204 | 388 // This test brought to you by http://crbug.com/69204 |
385 #if defined(OS_MACOSX) | 389 #if defined(OS_MACOSX) |
386 // Sometimes times out on Mac: http://crbug.com/81451 | 390 // Sometimes times out on Mac: http://crbug.com/81451 |
387 #define MAYBE_AutofillAfterReload DISABLED_AutofillAfterReload | 391 // Currently enabled for logging. |
dhollowa
2011/06/08 14:45:17
Better to just delete these macros. You can add t
| |
392 #define MAYBE_AutofillAfterReload AutofillAfterReload | |
388 #else | 393 #else |
389 #define MAYBE_AutofillAfterReload AutofillAfterReload | 394 #define MAYBE_AutofillAfterReload AutofillAfterReload |
390 #endif | 395 #endif |
391 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillAfterReload) { | 396 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillAfterReload) { |
392 LOG(WARNING) << "Creating test profile."; | 397 LOG(WARNING) << "Creating test profile."; |
393 CreateTestProfile(); | 398 CreateTestProfile(); |
394 | 399 |
395 // Load the test page. | 400 // Load the test page. |
396 LOG(WARNING) << "Bringing browser window to front."; | 401 LOG(WARNING) << "Bringing browser window to front."; |
397 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 402 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 // Once click the text field, it starts again. | 481 // Once click the text field, it starts again. |
477 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 482 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
478 render_view_host(), L"", | 483 render_view_host(), L"", |
479 L"cr.googleTranslate.onTranslateElementLoad();")); | 484 L"cr.googleTranslate.onTranslateElementLoad();")); |
480 | 485 |
481 // Simulate the render notifying the translation has been done. | 486 // Simulate the render notifying the translation has been done. |
482 ui_test_utils::WaitForNotification(NotificationType::PAGE_TRANSLATED); | 487 ui_test_utils::WaitForNotification(NotificationType::PAGE_TRANSLATED); |
483 | 488 |
484 TryBasicFormFill(); | 489 TryBasicFormFill(); |
485 } | 490 } |
OLD | NEW |