OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/status/caps_lock_menu_button.h" | 5 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.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" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
14 | 14 |
| 15 #if defined(USE_AURA) |
| 16 #include "ui/aura_shell/shell.h" |
| 17 #include "views/widget/widget.h" |
| 18 #endif |
| 19 |
15 namespace chromeos { | 20 namespace chromeos { |
16 | 21 |
17 class CapsLockMenuButtonTest : public CrosInProcessBrowserTest { | 22 class CapsLockMenuButtonTest : public CrosInProcessBrowserTest { |
18 protected: | 23 protected: |
19 CapsLockMenuButtonTest() | 24 CapsLockMenuButtonTest() |
20 : CrosInProcessBrowserTest() { | 25 : CrosInProcessBrowserTest() { |
21 } | 26 } |
22 | 27 |
23 virtual void SetUpInProcessBrowserTestFixture() { | 28 virtual void SetUpInProcessBrowserTestFixture() { |
24 cros_mock_->InitStatusAreaMocks(); | 29 cros_mock_->InitStatusAreaMocks(); |
25 cros_mock_->SetStatusAreaMocksExpectations(); | 30 cros_mock_->SetStatusAreaMocksExpectations(); |
26 } | 31 } |
27 | 32 |
28 CapsLockMenuButton* GetCapsLockMenuButton() { | 33 CapsLockMenuButton* GetCapsLockMenuButton() { |
29 BrowserView* view = static_cast<BrowserView*>(browser()->window()); | 34 views::View *view = |
30 return static_cast<CapsLockMenuButton*>(view->GetViewByID( | 35 #if defined(USE_AURA) |
31 VIEW_ID_STATUS_BUTTON_CAPS_LOCK)); | 36 aura_shell::Shell::GetInstance()->GetStatusAreaWidget()-> |
| 37 GetContentsView(); |
| 38 #else |
| 39 static_cast<BrowserView*>(browser()->window()); |
| 40 #endif |
| 41 return static_cast<CapsLockMenuButton*>( |
| 42 view->GetViewByID(VIEW_ID_STATUS_BUTTON_CAPS_LOCK)); |
32 } | 43 } |
33 }; | 44 }; |
34 | 45 |
35 IN_PROC_BROWSER_TEST_F(CapsLockMenuButtonTest, InitialIndicatorTest) { | 46 IN_PROC_BROWSER_TEST_F(CapsLockMenuButtonTest, InitialIndicatorTest) { |
36 CapsLockMenuButton* caps_lock = GetCapsLockMenuButton(); | 47 CapsLockMenuButton* caps_lock = GetCapsLockMenuButton(); |
37 ASSERT_TRUE(caps_lock != NULL); | 48 ASSERT_TRUE(caps_lock != NULL); |
38 | 49 |
39 // By default, the indicator shouldn't be shown. | 50 // By default, the indicator shouldn't be shown. |
40 EXPECT_FALSE(caps_lock->IsVisible()); | 51 EXPECT_FALSE(caps_lock->IsVisible()); |
41 } | 52 } |
42 | 53 |
43 } // namespace chromeos | 54 } // namespace chromeos |
OLD | NEW |