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

Side by Side Diff: chrome/browser/chromeos/compact_location_bar_host_browsertest.cc

Issue 2812007: Remove compact navbar: 1st step. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: " Created 10 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/compact_navigation_bar_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/automation/ui_controls.h"
6 #include "chrome/browser/browser.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/chromeos/compact_location_bar_host.h"
9 #include "chrome/browser/chromeos/frame/browser_view.h"
10 #include "chrome/browser/chromeos/view_ids.h"
11 #include "chrome/test/in_process_browser_test.h"
12 #include "chrome/test/ui_test_utils.h"
13 #include "views/widget/widget.h"
14 #include "views/window/window.h"
15
16 namespace chromeos {
17
18 class CompactLocationBarHostTest : public InProcessBrowserTest {
19 public:
20 CompactLocationBarHostTest() {
21 }
22
23 virtual void SetUp() {
24 // Don't animate during the test.
25 DropdownBarHost::disable_animations_during_testing_ = true;
26 InProcessBrowserTest::SetUp();
27 }
28
29 BrowserView* browser_view() const {
30 return static_cast<BrowserView*>(browser()->window());
31 }
32
33 gfx::NativeWindow window() const {
34 return browser_view()->GetNativeHandle();
35 }
36
37 CompactLocationBarHost* clb_host() const {
38 return browser_view()->compact_location_bar_host();
39 }
40
41 bool IsViewIdVisible(int id) const {
42 return browser_view()->GetViewByID(id)->IsVisible();
43 }
44
45 bool IsCurrentTabIndex(int index) {
46 return clb_host()->IsCurrentTabIndex(index);
47 }
48
49 private:
50 DISALLOW_COPY_AND_ASSIGN(CompactLocationBarHostTest);
51 };
52
53 IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestCtrlLOpen) {
54 // ctrl-l should not open compact location bar in normal mode.
55 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false);
56 ui_test_utils::RunAllPendingInMessageLoop();
57 EXPECT_TRUE(IsCurrentTabIndex(-1));
58 EXPECT_FALSE(clb_host()->IsVisible());
59
60 browser()->ToggleCompactNavigationBar();
61 ui_test_utils::RunAllPendingInMessageLoop();
62 EXPECT_TRUE(IsCurrentTabIndex(-1));
63 EXPECT_FALSE(clb_host()->IsVisible());
64
65 // ctrl-l should not open compact location bar in compact nav mode.
66 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false);
67 ui_test_utils::RunAllPendingInMessageLoop();
68 EXPECT_TRUE(IsCurrentTabIndex(0));
69 EXPECT_TRUE(clb_host()->IsVisible());
70
71 // Esc to close it.
72 ui_controls::SendKeyPress(window(), base::VKEY_ESCAPE,
73 false, false, false, false);
74 ui_test_utils::RunAllPendingInMessageLoop();
75 EXPECT_TRUE(IsCurrentTabIndex(0));
76 EXPECT_FALSE(clb_host()->IsVisible());
77 }
78
79 IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestOnNewTab) {
80 browser()->ToggleCompactNavigationBar();
81 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false);
82 ui_test_utils::RunAllPendingInMessageLoop();
83 EXPECT_TRUE(IsCurrentTabIndex(0));
84 EXPECT_TRUE(clb_host()->IsVisible());
85
86 browser()->NewTab();
87 ui_test_utils::RunAllPendingInMessageLoop();
88
89 // See http://crbug.com/39858 for details.
90 //EXPECT_FALSE(clb_host()->IsVisible());
91
92 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false);
93 ui_test_utils::RunAllPendingInMessageLoop();
94 EXPECT_TRUE(IsCurrentTabIndex(1));
95 EXPECT_TRUE(clb_host()->IsVisible());
96 }
97
98 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/compact_navigation_bar_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698