OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The Chromium Authors. All rights reserved. | 2 * Copyright 2013 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ASSERT_TRUE(keyboard_rvh); | 122 ASSERT_TRUE(keyboard_rvh); |
123 bool loaded = false; | 123 bool loaded = false; |
124 std::string script = "!!chrome.virtualKeyboardPrivate"; | 124 std::string script = "!!chrome.virtualKeyboardPrivate"; |
125 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 125 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
126 keyboard_rvh, | 126 keyboard_rvh, |
127 "window.domAutomationController.send(" + script + ");", | 127 "window.domAutomationController.send(" + script + ");", |
128 &loaded)); | 128 &loaded)); |
129 // Catches the regression in crbug.com/308653. | 129 // Catches the regression in crbug.com/308653. |
130 ASSERT_TRUE(loaded); | 130 ASSERT_TRUE(loaded); |
131 } | 131 } |
132 // TODO(rsadam): Add an end to end test to verify that characters typed in the | 132 |
133 // keyboard actually appear in the other window. | 133 IN_PROC_BROWSER_TEST_F(VirtualKeyboardBrowserTest, EndToEndTest) { |
| 134 // Get the virtual keyboard's render view host. |
| 135 content::RenderViewHost* keyboard_rvh = GetKeyboardRenderViewHost(); |
| 136 ASSERT_TRUE(keyboard_rvh); |
| 137 |
| 138 // Get the test page's render view host. |
| 139 content::RenderViewHost* browser_rvh = browser()->tab_strip_model()-> |
| 140 GetActiveWebContents()->GetRenderViewHost(); |
| 141 ASSERT_TRUE(browser_rvh); |
| 142 |
| 143 // Set up the test page. |
| 144 GURL url = ui_test_utils::GetTestUrl( |
| 145 base::FilePath(), |
| 146 base::FilePath(FILE_PATH_LITERAL( |
| 147 "chromeos/virtual_keyboard/end_to_end_test.html"))); |
| 148 ui_test_utils::NavigateToURL(browser(), url); |
| 149 |
| 150 // Press 'a' on keyboard. |
| 151 base::FilePath path = ui_test_utils::GetTestFilePath( |
| 152 kVirtualKeyboardTestDir, |
| 153 base::FilePath(FILE_PATH_LITERAL("end_to_end_test.js"))); |
| 154 std::string script; |
| 155 ASSERT_TRUE(base::ReadFileToString(path, &script)); |
| 156 EXPECT_TRUE(content::ExecuteScript(keyboard_rvh, script)); |
| 157 // Verify 'a' appeared on test page. |
| 158 bool success = false; |
| 159 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 160 browser_rvh, |
| 161 "success ? verifyInput('a') : waitForInput('a');", |
| 162 &success)); |
| 163 ASSERT_TRUE(success); |
| 164 } |
134 | 165 |
135 // TODO(kevers|rsadam|bshe): Add UI tests for remaining virtual keyboard | 166 // TODO(kevers|rsadam|bshe): Add UI tests for remaining virtual keyboard |
136 // functionality. | 167 // functionality. |
OLD | NEW |