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

Unified Diff: chrome/browser/ui/ash/keyboard_end_to_end_browsertest.cc

Issue 2702933002: Add an end to end test: virtual keyboard opens on click of text input (Closed)
Patch Set: Added dependency to ui/keyboard:test_support in browser_tests instead of a target in ash/test/ Created 3 years, 9 months 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
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/keyboard_end_to_end_browsertest.cc
diff --git a/chrome/browser/ui/ash/keyboard_end_to_end_browsertest.cc b/chrome/browser/ui/ash/keyboard_end_to_end_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2a256689c4e9cde795dfe250c5342cb4afbccc26
--- /dev/null
+++ b/chrome/browser/ui/ash/keyboard_end_to_end_browsertest.cc
@@ -0,0 +1,60 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "base/files/file.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/test/browser_test_utils.h"
+#include "ui/keyboard/content/keyboard_constants.h"
+#include "ui/keyboard/keyboard_controller.h"
+#include "ui/keyboard/keyboard_switches.h"
+#include "ui/keyboard/keyboard_test_util.h"
+
+namespace {
oshima 2017/03/22 21:03:44 nit: new line before after function
oka 2017/03/22 21:14:21 Done.
+bool IsKeyboardVisible() {
+ return keyboard::KeyboardController::GetInstance()->keyboard_visible();
+}
+} // namespace
+
+namespace keyboard {
+
+class KeyboardEndToEndTest : public InProcessBrowserTest {
+ public:
+ KeyboardEndToEndTest() {}
+ ~KeyboardEndToEndTest() override {}
+
+ // Ensure that the virtual keyboard is enabled.
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ command_line->AppendSwitch(keyboard::switches::kEnableVirtualKeyboard);
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(KeyboardEndToEndTest, OpenAndCloseOnFocusAndBlur) {
+ GURL test_url =
+ ui_test_utils::GetTestUrl(base::FilePath("chromeos/virtual_keyboard"),
+ base::FilePath("inputs.html"));
+ ui_test_utils::NavigateToURL(browser(), test_url);
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(web_contents);
+
+ EXPECT_FALSE(IsKeyboardVisible());
+
+ ASSERT_TRUE(content::ExecuteScript(
+ web_contents, "document.getElementById('text').focus();"));
+
+ ASSERT_TRUE(keyboard::WaitUntilShown());
+ EXPECT_TRUE(IsKeyboardVisible());
+
+ ASSERT_TRUE(content::ExecuteScript(
+ web_contents, "document.getElementById('text').blur();"));
+
+ ASSERT_TRUE(keyboard::WaitUntilHidden());
+ EXPECT_FALSE(IsKeyboardVisible());
+}
+
+} // namespace keyboard
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698