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

Side by Side 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 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 unified diff | Download patch
OLDNEW
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
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.
miket_OOO 2013/12/03 17:20:27 Be consistent about voice of comments ("Get" here
rsadam 2013/12/03 18:57:27 Done.
139 content::RenderViewHost* browser_rvh = browser()->tab_strip_model()
140 ->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
141 ASSERT_TRUE(browser_rvh);
142
143 // Sets 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,
157 script));
miket_OOO 2013/12/03 17:20:27 no need to wrap this
rsadam 2013/12/03 18:57:27 Done.
158 // Verify 'a' appeared on test page.
159 bool success = false;
160 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
161 browser_rvh,
162 "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.
163 &success));
164 ASSERT_TRUE(success);
165 }
134 166
135 // TODO(kevers|rsadam|bshe): Add UI tests for remaining virtual keyboard 167 // TODO(kevers|rsadam|bshe): Add UI tests for remaining virtual keyboard
136 // functionality. 168 // functionality.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698