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/input_method_menu_button.h" | 5 #include "chrome/browser/chromeos/status/input_method_menu_button.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.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 "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 17 #endif |
| 18 |
15 namespace chromeos { | 19 namespace chromeos { |
16 | 20 |
17 class InputMethodMenuButtonTest : public CrosInProcessBrowserTest { | 21 class InputMethodMenuButtonTest : public CrosInProcessBrowserTest { |
18 protected: | 22 protected: |
19 InputMethodMenuButtonTest() | 23 InputMethodMenuButtonTest() |
20 : CrosInProcessBrowserTest() { | 24 : CrosInProcessBrowserTest() { |
21 } | 25 } |
22 | 26 |
23 virtual void SetUpInProcessBrowserTestFixture() { | 27 virtual void SetUpInProcessBrowserTestFixture() { |
24 cros_mock_->InitStatusAreaMocks(); | 28 cros_mock_->InitStatusAreaMocks(); |
25 cros_mock_->SetStatusAreaMocksExpectations(); | 29 cros_mock_->SetStatusAreaMocksExpectations(); |
26 } | 30 } |
27 | 31 |
28 InputMethodMenuButton* GetInputMethodMenuButton() { | 32 const InputMethodMenuButton* GetInputMethodMenuButton() { |
29 BrowserView* view = static_cast<BrowserView*>(browser()->window()); | 33 const views::View* view = |
30 return static_cast<InputMethodMenuButton*>(view->GetViewByID( | 34 #if defined(USE_AURA) |
31 VIEW_ID_STATUS_BUTTON_INPUT_METHOD)); | 35 ChromeShellDelegate::instance()->GetStatusAreaForTest(); |
| 36 #else |
| 37 static_cast<BrowserView*>(browser()->window()); |
| 38 #endif |
| 39 return static_cast<const InputMethodMenuButton*>( |
| 40 view->GetViewByID(VIEW_ID_STATUS_BUTTON_INPUT_METHOD)); |
32 } | 41 } |
33 }; | 42 }; |
34 | 43 |
35 IN_PROC_BROWSER_TEST_F(InputMethodMenuButtonTest, InitialIndicatorTest) { | 44 IN_PROC_BROWSER_TEST_F(InputMethodMenuButtonTest, InitialIndicatorTest) { |
36 InputMethodMenuButton* input_method = GetInputMethodMenuButton(); | 45 const InputMethodMenuButton* input_method = GetInputMethodMenuButton(); |
37 ASSERT_TRUE(input_method != NULL); | 46 ASSERT_TRUE(input_method != NULL); |
38 | 47 |
39 // By default, show the indicator of the hardware keyboard, which is set | 48 // By default, show the indicator of the hardware keyboard, which is set |
40 // to US for tests. | 49 // to US for tests. |
41 EXPECT_EQ(ASCIIToUTF16("US"), input_method->text()); | 50 EXPECT_EQ(ASCIIToUTF16("US"), input_method->text()); |
42 } | 51 } |
43 | 52 |
44 } // namespace chromeos | 53 } // namespace chromeos |
OLD | NEW |