diff options
-rw-r--r-- | chrome/browser/accessibility_win_browsertest.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/chrome/browser/accessibility_win_browsertest.cc b/chrome/browser/accessibility_win_browsertest.cc index 2199a07..d6bc3da 100644 --- a/chrome/browser/accessibility_win_browsertest.cc +++ b/chrome/browser/accessibility_win_browsertest.cc @@ -19,10 +19,43 @@ namespace { class AccessibilityWinBrowserTest : public InProcessBrowserTest { + public: + AccessibilityWinBrowserTest() : screenreader_running_(FALSE) {} + + // InProcessBrowserTest + void SetUpInProcessBrowserTestFixture(); + void TearDownInProcessBrowserTestFixture(); + protected: IAccessible* GetRenderWidgetHostViewClientAccessible(); + + private: + BOOL screenreader_running_; }; +void AccessibilityWinBrowserTest::SetUpInProcessBrowserTestFixture() { + // This test assumes the windows system-wide SPI_SETSCREENREADER flag is + // cleared. + if (SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenreader_running_, 0) && + screenreader_running_) { + // Clear the SPI_SETSCREENREADER flag and notify active applications about + // the setting change. + ::SystemParametersInfo(SPI_SETSCREENREADER, FALSE, NULL, 0); + ::SendNotifyMessage( + HWND_BROADCAST, WM_SETTINGCHANGE, SPI_GETSCREENREADER, 0); + } +} + +void AccessibilityWinBrowserTest::TearDownInProcessBrowserTestFixture() { + if (screenreader_running_) { + // Restore the SPI_SETSCREENREADER flag and notify active applications about + // the setting change. + ::SystemParametersInfo(SPI_SETSCREENREADER, TRUE, NULL, 0); + ::SendNotifyMessage( + HWND_BROADCAST, WM_SETTINGCHANGE, SPI_GETSCREENREADER, 0); + } +} + class AccessibleChecker { public: AccessibleChecker(std::wstring expected_name, int32 expected_role); |