OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/automation/ui_controls.h" | 5 #include "chrome/browser/automation/ui_controls.h" |
6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chromeos/compact_location_bar_host.h" | 8 #include "chrome/browser/chromeos/compact_location_bar_host.h" |
9 #include "chrome/browser/chromeos/frame/browser_view.h" | 9 #include "chrome/browser/chromeos/frame/browser_view.h" |
10 #include "chrome/browser/chromeos/view_ids.h" | 10 #include "chrome/browser/chromeos/view_ids.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool IsCurrentTabIndex(int index) { | 45 bool IsCurrentTabIndex(int index) { |
46 return clb_host()->IsCurrentTabIndex(index); | 46 return clb_host()->IsCurrentTabIndex(index); |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 DISALLOW_COPY_AND_ASSIGN(CompactLocationBarHostTest); | 50 DISALLOW_COPY_AND_ASSIGN(CompactLocationBarHostTest); |
51 }; | 51 }; |
52 | 52 |
53 IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestCtrlLOpen) { | 53 IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestCtrlLOpen) { |
54 // ctrl-l should not open compact location bar in normal mode. | 54 // ctrl-l should not open compact location bar in normal mode. |
55 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false); | 55 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false); |
56 ui_test_utils::RunAllPendingInMessageLoop(); | 56 ui_test_utils::RunAllPendingInMessageLoop(); |
57 EXPECT_TRUE(IsCurrentTabIndex(-1)); | 57 EXPECT_TRUE(IsCurrentTabIndex(-1)); |
58 EXPECT_FALSE(clb_host()->IsVisible()); | 58 EXPECT_FALSE(clb_host()->IsVisible()); |
59 | 59 |
60 browser()->ToggleCompactNavigationBar(); | 60 browser()->ToggleCompactNavigationBar(); |
61 ui_test_utils::RunAllPendingInMessageLoop(); | 61 ui_test_utils::RunAllPendingInMessageLoop(); |
62 EXPECT_TRUE(IsCurrentTabIndex(-1)); | 62 EXPECT_TRUE(IsCurrentTabIndex(-1)); |
63 EXPECT_FALSE(clb_host()->IsVisible()); | 63 EXPECT_FALSE(clb_host()->IsVisible()); |
64 | 64 |
65 // ctrl-l should not open compact location bar in compact nav mode. | 65 // ctrl-l should not open compact location bar in compact nav mode. |
66 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false); | 66 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false); |
67 ui_test_utils::RunAllPendingInMessageLoop(); | 67 ui_test_utils::RunAllPendingInMessageLoop(); |
68 EXPECT_TRUE(IsCurrentTabIndex(0)); | 68 EXPECT_TRUE(IsCurrentTabIndex(0)); |
69 EXPECT_TRUE(clb_host()->IsVisible()); | 69 EXPECT_TRUE(clb_host()->IsVisible()); |
70 | 70 |
71 // Esc to close it. | 71 // Esc to close it. |
72 ui_controls::SendKeyPress(window(), base::VKEY_ESCAPE, false, false, false); | 72 ui_controls::SendKeyPress(window(), base::VKEY_ESCAPE, |
| 73 false, false, false, false); |
73 ui_test_utils::RunAllPendingInMessageLoop(); | 74 ui_test_utils::RunAllPendingInMessageLoop(); |
74 EXPECT_TRUE(IsCurrentTabIndex(0)); | 75 EXPECT_TRUE(IsCurrentTabIndex(0)); |
75 EXPECT_FALSE(clb_host()->IsVisible()); | 76 EXPECT_FALSE(clb_host()->IsVisible()); |
76 } | 77 } |
77 | 78 |
78 IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestOnNewTab) { | 79 IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestOnNewTab) { |
79 browser()->ToggleCompactNavigationBar(); | 80 browser()->ToggleCompactNavigationBar(); |
80 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false); | 81 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false); |
81 ui_test_utils::RunAllPendingInMessageLoop(); | 82 ui_test_utils::RunAllPendingInMessageLoop(); |
82 EXPECT_TRUE(IsCurrentTabIndex(0)); | 83 EXPECT_TRUE(IsCurrentTabIndex(0)); |
83 EXPECT_TRUE(clb_host()->IsVisible()); | 84 EXPECT_TRUE(clb_host()->IsVisible()); |
84 | 85 |
85 browser()->NewTab(); | 86 browser()->NewTab(); |
86 ui_test_utils::RunAllPendingInMessageLoop(); | 87 ui_test_utils::RunAllPendingInMessageLoop(); |
87 | 88 |
88 // See http://crbug.com/39858 for details. | 89 // See http://crbug.com/39858 for details. |
89 //EXPECT_FALSE(clb_host()->IsVisible()); | 90 //EXPECT_FALSE(clb_host()->IsVisible()); |
90 | 91 |
91 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false); | 92 ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false, false); |
92 ui_test_utils::RunAllPendingInMessageLoop(); | 93 ui_test_utils::RunAllPendingInMessageLoop(); |
93 EXPECT_TRUE(IsCurrentTabIndex(1)); | 94 EXPECT_TRUE(IsCurrentTabIndex(1)); |
94 EXPECT_TRUE(clb_host()->IsVisible()); | 95 EXPECT_TRUE(clb_host()->IsVisible()); |
95 } | 96 } |
96 | 97 |
97 } // namespace chromeos | 98 } // namespace chromeos |
OLD | NEW |