Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.cc

Issue 83483004: End to End browser test for the virtual keyboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@api-tests
Patch Set: Rebase + fixed nits. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698