Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.cc |
| diff --git a/chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.cc b/chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.cc |
| index b8d60246d5d8c430e9ceeff749e6053bf6adbbca..f99154eb719fd214a67c2acecad8c0aebe593172 100644 |
| --- a/chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.cc |
| +++ b/chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.cc |
| @@ -129,8 +129,40 @@ IN_PROC_BROWSER_TEST_F(VirtualKeyboardBrowserTest, IsKeyboardLoaded) { |
| // Catches the regression in crbug.com/308653. |
| ASSERT_TRUE(loaded); |
| } |
| -// TODO(rsadam): Add an end to end test to verify that characters typed in the |
| -// keyboard actually appear in the other window. |
| + |
| +IN_PROC_BROWSER_TEST_F(VirtualKeyboardBrowserTest, EndToEndTest) { |
| + // Get the virtual keyboard's render view host. |
| + content::RenderViewHost* keyboard_rvh = GetKeyboardRenderViewHost(); |
| + ASSERT_TRUE(keyboard_rvh); |
| + |
| + // Get the test page's render view host. |
|
miket_OOO
2013/12/03 17:20:27
Be consistent about voice of comments ("Get" here
rsadam
2013/12/03 18:57:27
Done.
|
| + content::RenderViewHost* browser_rvh = browser()->tab_strip_model() |
| + ->GetActiveWebContents()->GetRenderViewHost(); |
|
miket_OOO
2013/12/03 17:20:27
There is an extra space after the =, and prevailin
rsadam
2013/12/03 18:57:27
Wrapping at = leads to an 81 char line, so just mo
|
| + ASSERT_TRUE(browser_rvh); |
| + |
| + // Sets up the test page. |
| + GURL url = ui_test_utils::GetTestUrl( |
| + base::FilePath(), |
| + base::FilePath(FILE_PATH_LITERAL( |
| + "chromeos/virtual_keyboard/end_to_end_test.html"))); |
| + ui_test_utils::NavigateToURL(browser(), url); |
| + |
| + // Press 'a' on keyboard. |
| + base::FilePath path = ui_test_utils::GetTestFilePath( |
| + kVirtualKeyboardTestDir, |
| + base::FilePath(FILE_PATH_LITERAL("end_to_end_test.js"))); |
| + std::string script; |
| + ASSERT_TRUE(base::ReadFileToString(path, &script)); |
| + EXPECT_TRUE(content::ExecuteScript(keyboard_rvh, |
| + script)); |
|
miket_OOO
2013/12/03 17:20:27
no need to wrap this
rsadam
2013/12/03 18:57:27
Done.
|
| + // Verify 'a' appeared on test page. |
| + bool success = false; |
| + EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| + browser_rvh, |
| + "success? verifyInput('a'): waitForInput('a');", |
|
miket_OOO
2013/12/03 17:20:27
Binary operators ? and : should have whitespace on
rsadam
2013/12/03 18:57:27
Done.
|
| + &success)); |
| + ASSERT_TRUE(success); |
| +} |
| // TODO(kevers|rsadam|bshe): Add UI tests for remaining virtual keyboard |
| // functionality. |