| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 " <option value=\"CA\">Canada</option>" | 499 " <option value=\"CA\">Canada</option>" |
| 500 " <option value=\"US\">United States</option>" | 500 " <option value=\"US\">United States</option>" |
| 501 " </select><br />" | 501 " </select><br />" |
| 502 "<label for=\"ph\">Phone number:</label>" | 502 "<label for=\"ph\">Phone number:</label>" |
| 503 " <input type=\"text\" id=\"ph\" /><br />" | 503 " <input type=\"text\" id=\"ph\" /><br />" |
| 504 "</form>"); | 504 "</form>"); |
| 505 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 505 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 506 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), url)); | 506 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), url)); |
| 507 | 507 |
| 508 // Get translation bar. | 508 // Get translation bar. |
| 509 render_view_host()->OnMessageReceived(ViewHostMsg_TranslateLanguageDetermined( | 509 render_view_host()->OnMessageReceived( |
| 510 0, "ja", true)); | 510 ChromeViewHostMsg_TranslateLanguageDetermined(0, "ja", true)); |
| 511 TranslateInfoBarDelegate* infobar = | 511 TranslateInfoBarDelegate* infobar = |
| 512 browser()->GetSelectedTabContentsWrapper()-> | 512 browser()->GetSelectedTabContentsWrapper()-> |
| 513 GetInfoBarDelegateAt(0)->AsTranslateInfoBarDelegate(); | 513 GetInfoBarDelegateAt(0)->AsTranslateInfoBarDelegate(); |
| 514 | 514 |
| 515 ASSERT_TRUE(infobar != NULL); | 515 ASSERT_TRUE(infobar != NULL); |
| 516 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type()); | 516 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type()); |
| 517 | 517 |
| 518 // Simulate translation button press. | 518 // Simulate translation button press. |
| 519 infobar->Translate(); | 519 infobar->Translate(); |
| 520 | 520 |
| 521 // Simulate the translate script being retrieved. | 521 // Simulate the translate script being retrieved. |
| 522 // Pass fake google.translate lib as the translate script. | 522 // Pass fake google.translate lib as the translate script. |
| 523 SimulateURLFetch(true); | 523 SimulateURLFetch(true); |
| 524 | 524 |
| 525 // Simulate translation to kick onTranslateElementLoad. | 525 // Simulate translation to kick onTranslateElementLoad. |
| 526 // But right now, the call stucks here. | 526 // But right now, the call stucks here. |
| 527 // Once click the text field, it starts again. | 527 // Once click the text field, it starts again. |
| 528 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 528 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
| 529 render_view_host(), L"", | 529 render_view_host(), L"", |
| 530 L"cr.googleTranslate.onTranslateElementLoad();")); | 530 L"cr.googleTranslate.onTranslateElementLoad();")); |
| 531 | 531 |
| 532 // Simulate the render notifying the translation has been done. | 532 // Simulate the render notifying the translation has been done. |
| 533 ui_test_utils::WaitForNotification(chrome::NOTIFICATION_PAGE_TRANSLATED); | 533 ui_test_utils::WaitForNotification(chrome::NOTIFICATION_PAGE_TRANSLATED); |
| 534 | 534 |
| 535 TryBasicFormFill(); | 535 TryBasicFormFill(); |
| 536 } | 536 } |
| OLD | NEW |