Home | History | Annotate | Download | only in status
      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/chromeos/status/input_method_menu_button.h"
      6 
      7 #include "base/string_util.h"
      8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
      9 #include "chrome/browser/chromeos/cros/mock_input_method_library.h"
     10 #include "chrome/browser/chromeos/frame/browser_view.h"
     11 #include "chrome/browser/chromeos/status/status_area_view.h"
     12 #include "chrome/browser/chromeos/view_ids.h"
     13 #include "chrome/browser/ui/browser.h"
     14 #include "chrome/browser/ui/browser_window.h"
     15 #include "grit/theme_resources.h"
     16 
     17 namespace chromeos {
     18 
     19 class InputMethodMenuButtonTest : public CrosInProcessBrowserTest {
     20  protected:
     21   InputMethodMenuButtonTest()
     22       : CrosInProcessBrowserTest() {
     23   }
     24 
     25   virtual void SetUpInProcessBrowserTestFixture() {
     26     cros_mock_->InitStatusAreaMocks();
     27     cros_mock_->SetStatusAreaMocksExpectations();
     28   }
     29 
     30   InputMethodMenuButton* GetInputMethodMenuButton() {
     31     BrowserView* view = static_cast<BrowserView*>(browser()->window());
     32     return static_cast<StatusAreaView*>(view->
     33         GetViewByID(VIEW_ID_STATUS_AREA))->input_method_view();
     34   }
     35 };
     36 
     37 IN_PROC_BROWSER_TEST_F(InputMethodMenuButtonTest, InitialIndicatorTest) {
     38   InputMethodMenuButton* input_method = GetInputMethodMenuButton();
     39   ASSERT_TRUE(input_method != NULL);
     40 
     41   // By default, show the indicator of the hardware keyboard, which is set
     42   // to US for tests.
     43   std::wstring indicator = input_method->text();
     44   EXPECT_EQ(L"US", indicator);
     45 }
     46 
     47 }  // namespace chromeos
     48