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

Side by Side Diff: chrome/browser/ui/ash/keyboard_end_to_end_browsertest.cc

Issue 2771793002: End to end test: async focus shouldn't trigger virtual keyboard. (Closed)
Patch Set: . 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file.h" 6 #include "base/files/file.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" 8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 class KeyboardEndToEndTest : public InProcessBrowserTest { 50 class KeyboardEndToEndTest : public InProcessBrowserTest {
51 public: 51 public:
52 KeyboardEndToEndTest() {} 52 KeyboardEndToEndTest() {}
53 ~KeyboardEndToEndTest() override {} 53 ~KeyboardEndToEndTest() override {}
54 54
55 // Ensure that the virtual keyboard is enabled. 55 // Ensure that the virtual keyboard is enabled.
56 void SetUpCommandLine(base::CommandLine* command_line) override { 56 void SetUpCommandLine(base::CommandLine* command_line) override {
57 command_line->AppendSwitch(keyboard::switches::kEnableVirtualKeyboard); 57 command_line->AppendSwitch(keyboard::switches::kEnableVirtualKeyboard);
58 } 58 }
59
60 void SetUpOnMainThread() override {
61 GURL test_url =
62 ui_test_utils::GetTestUrl(base::FilePath("chromeos/virtual_keyboard"),
63 base::FilePath("inputs.html"));
64 ui_test_utils::NavigateToURL(browser(), test_url);
65 web_contents = browser()->tab_strip_model()->GetActiveWebContents();
66 ASSERT_TRUE(web_contents);
67
68 EXPECT_FALSE(IsKeyboardVisible());
69 }
70
71 // Initialized in |SetUpOnMainThread|.
oshima 2017/03/27 16:57:54 nit: private: and DISALLOW_COPY_AND_ASSIGN
oka 2017/03/28 11:13:26 Done.
72 content::WebContents* web_contents;
59 }; 73 };
60 74
61 IN_PROC_BROWSER_TEST_F(KeyboardEndToEndTest, OpenIfFocusedOnClick) { 75 IN_PROC_BROWSER_TEST_F(KeyboardEndToEndTest, OpenIfFocusedOnClick) {
62 GURL test_url =
63 ui_test_utils::GetTestUrl(base::FilePath("chromeos/virtual_keyboard"),
64 base::FilePath("inputs.html"));
65 ui_test_utils::NavigateToURL(browser(), test_url);
66 content::WebContents* web_contents =
67 browser()->tab_strip_model()->GetActiveWebContents();
68 ASSERT_TRUE(web_contents);
69
70 EXPECT_FALSE(IsKeyboardVisible());
71
72 ClickElementWithId(web_contents, "text"); 76 ClickElementWithId(web_contents, "text");
73 77
74 ASSERT_TRUE(keyboard::WaitUntilShown()); 78 ASSERT_TRUE(keyboard::WaitUntilShown());
75 EXPECT_TRUE(IsKeyboardVisible()); 79 EXPECT_TRUE(IsKeyboardVisible());
76 80
77 ClickElementWithId(web_contents, "blur"); 81 ClickElementWithId(web_contents, "blur");
78 ASSERT_TRUE(keyboard::WaitUntilHidden()); 82 ASSERT_TRUE(keyboard::WaitUntilHidden());
79 EXPECT_FALSE(IsKeyboardVisible()); 83 EXPECT_FALSE(IsKeyboardVisible());
80 } 84 }
85
86 IN_PROC_BROWSER_TEST_F(KeyboardEndToEndTest, OpenOnlyOnSyncFocus) {
87 ClickElementWithId(web_contents, "sync");
88
89 ASSERT_TRUE(keyboard::WaitUntilShown());
90 EXPECT_TRUE(IsKeyboardVisible());
91
92 ClickElementWithId(web_contents, "async");
93 ASSERT_TRUE(keyboard::WaitUntilHidden());
94 EXPECT_FALSE(IsKeyboardVisible());
95 }
81 96
82 } // namespace keyboard 97 } // namespace keyboard
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698