| 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/accessibility_menu_button.h" | 5 #include "chrome/browser/chromeos/status/accessibility_menu_button.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 7 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 8 #include "chrome/browser/chromeos/frame/browser_view.h" | 8 #include "chrome/browser/chromeos/frame/browser_view.h" |
| 9 #include "chrome/browser/chromeos/status/status_area_view.h" |
| 9 #include "chrome/browser/chromeos/view_ids.h" | 10 #include "chrome/browser/chromeos/view_ids.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 13 | 14 |
| 14 #if defined(USE_AURA) | 15 #if defined(USE_AURA) |
| 15 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" | 16 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 namespace chromeos { | 19 namespace chromeos { |
| 19 | 20 |
| 20 class AccessibilityMenuButtonTest : public InProcessBrowserTest { | 21 class AccessibilityMenuButtonTest : public InProcessBrowserTest { |
| 21 protected: | 22 protected: |
| 22 AccessibilityMenuButtonTest() : InProcessBrowserTest() { | 23 AccessibilityMenuButtonTest() : InProcessBrowserTest() { |
| 23 } | 24 } |
| 24 | 25 |
| 25 const AccessibilityMenuButton* GetAccessibilityMenuButton() { | 26 const AccessibilityMenuButton* GetAccessibilityMenuButton() { |
| 26 const views::View* view = | 27 const views::View* view = |
| 27 #if defined(USE_AURA) | 28 #if defined(USE_AURA) |
| 28 ChromeShellDelegate::instance()->GetStatusAreaForTest(); | 29 ChromeShellDelegate::instance()->GetStatusArea(); |
| 29 #else | 30 #else |
| 30 static_cast<BrowserView*>(browser()->window()); | 31 static_cast<BrowserView*>(browser()->window()); |
| 31 #endif | 32 #endif |
| 32 return static_cast<const AccessibilityMenuButton*>( | 33 return static_cast<const AccessibilityMenuButton*>( |
| 33 view->GetViewByID(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY)); | 34 view->GetViewByID(VIEW_ID_STATUS_BUTTON_ACCESSIBILITY)); |
| 34 } | 35 } |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 IN_PROC_BROWSER_TEST_F(AccessibilityMenuButtonTest, | 38 IN_PROC_BROWSER_TEST_F(AccessibilityMenuButtonTest, |
| 38 VisibilityIsSyncedWithPreference) { | 39 VisibilityIsSyncedWithPreference) { |
| 39 const AccessibilityMenuButton* button = GetAccessibilityMenuButton(); | 40 const AccessibilityMenuButton* button = GetAccessibilityMenuButton(); |
| 40 ASSERT_TRUE(button != NULL); | 41 ASSERT_TRUE(button != NULL); |
| 41 | 42 |
| 42 accessibility::EnableAccessibility(true, NULL); | 43 accessibility::EnableAccessibility(true, NULL); |
| 43 EXPECT_TRUE(button->IsVisible()); | 44 EXPECT_TRUE(button->IsVisible()); |
| 44 | 45 |
| 45 accessibility::EnableAccessibility(false, NULL); | 46 accessibility::EnableAccessibility(false, NULL); |
| 46 EXPECT_FALSE(button->IsVisible()); | 47 EXPECT_FALSE(button->IsVisible()); |
| 47 } | 48 } |
| 48 | 49 |
| 49 } // namespace chromeos | 50 } // namespace chromeos |
| OLD | NEW |