Commit e7db8ae3 authored by derat@chromium.org's avatar derat@chromium.org

aura: Fix input method and a11y status area browser tests.

This fixes InputMethodMenuButtonTest and
AccessibilityMenuButtonTest, which were failing due to the
same NULL-status-area problem as the tests fixed by r110851
and r111006.

BUG=103482,103492
TEST=ran them for both aura and non-aura chrome os

Review URL: http://codereview.chromium.org/8625004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111061 0039d316-1c4b-4281-b951-d872f2087c98
parent 92d86a2c
......@@ -11,6 +11,10 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#if defined(USE_AURA)
#include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
#endif
namespace chromeos {
class AccessibilityMenuButtonTest : public InProcessBrowserTest {
......@@ -18,16 +22,21 @@ class AccessibilityMenuButtonTest : public InProcessBrowserTest {
AccessibilityMenuButtonTest() : InProcessBrowserTest() {
}
AccessibilityMenuButton* GetAccessibilityMenuButton() {
BrowserView* view = static_cast<BrowserView*>(browser()->window());
return static_cast<AccessibilityMenuButton*>(view->GetViewByID(
VIEW_ID_STATUS_BUTTON_ACCESSIBILITY));
const AccessibilityMenuButton* GetAccessibilityMenuButton() {
const views::View* view =
#if defined(USE_AURA)
ChromeShellDelegate::instance()->GetStatusAreaForTest();
#else
static_cast<BrowserView*>(browser()->window());
#endif
return static_cast<const AccessibilityMenuButton*>(
view->GetViewByID(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY));
}
};
IN_PROC_BROWSER_TEST_F(AccessibilityMenuButtonTest,
VisibilityIsSyncedWithPreference) {
AccessibilityMenuButton* button = GetAccessibilityMenuButton();
const AccessibilityMenuButton* button = GetAccessibilityMenuButton();
ASSERT_TRUE(button != NULL);
accessibility::EnableAccessibility(true, NULL);
......
......@@ -12,6 +12,10 @@
#include "chrome/browser/ui/browser_window.h"
#include "grit/theme_resources.h"
#if defined(USE_AURA)
#include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
#endif
namespace chromeos {
class InputMethodMenuButtonTest : public CrosInProcessBrowserTest {
......@@ -25,15 +29,20 @@ class InputMethodMenuButtonTest : public CrosInProcessBrowserTest {
cros_mock_->SetStatusAreaMocksExpectations();
}
InputMethodMenuButton* GetInputMethodMenuButton() {
BrowserView* view = static_cast<BrowserView*>(browser()->window());
return static_cast<InputMethodMenuButton*>(view->GetViewByID(
VIEW_ID_STATUS_BUTTON_INPUT_METHOD));
const InputMethodMenuButton* GetInputMethodMenuButton() {
const views::View* view =
#if defined(USE_AURA)
ChromeShellDelegate::instance()->GetStatusAreaForTest();
#else
static_cast<BrowserView*>(browser()->window());
#endif
return static_cast<const InputMethodMenuButton*>(
view->GetViewByID(VIEW_ID_STATUS_BUTTON_INPUT_METHOD));
}
};
IN_PROC_BROWSER_TEST_F(InputMethodMenuButtonTest, InitialIndicatorTest) {
InputMethodMenuButton* input_method = GetInputMethodMenuButton();
const InputMethodMenuButton* input_method = GetInputMethodMenuButton();
ASSERT_TRUE(input_method != NULL);
// By default, show the indicator of the hardware keyboard, which is set
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment