summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-20 18:43:33 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-20 18:43:33 +0000
commit074bb33e9a178c8ab838d5c345915bfb4d3bc8e2 (patch)
treeda99fec7c4c96c998e66fb0b0859910f0408a76a
parent0bc8e288db1340e49b6c5502ececd02052a39b9b (diff)
downloadchromium_src-074bb33e9a178c8ab838d5c345915bfb4d3bc8e2.zip
chromium_src-074bb33e9a178c8ab838d5c345915bfb4d3bc8e2.tar.gz
chromium_src-074bb33e9a178c8ab838d5c345915bfb4d3bc8e2.tar.bz2
Merge 59899 - Remove code that enables renderer accessibility based on the SPI_GETSCREENREADER parameter.
Update chrome frame so that its test automation can still use renderer accessibility. BUG=55902 TEST=none Review URL: http://codereview.chromium.org/3383010 TBR=dtseng@chromium.org git-svn-id: svn://svn.chromium.org/chrome/branches/517/src@59948 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/accessibility_win_browsertest.cc29
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc5
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc6
-rw-r--r--chrome/common/chrome_switches.cc5
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome_frame/chrome_frame_automation.cc5
-rw-r--r--chrome_frame/chrome_launcher.cc1
-rw-r--r--chrome_frame/test/run_all_unittests.cc14
-rw-r--r--chrome_frame/utils.cc9
-rw-r--r--chrome_frame/utils.h5
10 files changed, 37 insertions, 43 deletions
diff --git a/chrome/browser/accessibility_win_browsertest.cc b/chrome/browser/accessibility_win_browsertest.cc
index a917f67..97f64aa 100644
--- a/chrome/browser/accessibility_win_browsertest.cc
+++ b/chrome/browser/accessibility_win_browsertest.cc
@@ -24,40 +24,19 @@ namespace {
class AccessibilityWinBrowserTest : public InProcessBrowserTest {
public:
- AccessibilityWinBrowserTest() : screenreader_running_(FALSE) {}
+ AccessibilityWinBrowserTest() {}
// 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);
- }
+ // If the mouse happens to be on the document then it will have the unexpected
+ // STATE_SYSTEM_HOTTRACKED state. Move it to a non-document location.
+ ui_controls::SendMouseMove(0, 0);
}
class AccessibleChecker {
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 5c5ee42..dff69c7 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -100,6 +100,11 @@ RenderWidgetHost::RenderWidgetHost(RenderProcessHost* process,
// Because the widget initializes as is_hidden_ == false,
// tell the process host that we're alive.
process_->WidgetRestored();
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceRendererAccessibility)) {
+ EnableRendererAccessibility();
+ }
}
RenderWidgetHost::~RenderWidgetHost() {
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 04b984a..a1d2a44 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -291,12 +291,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget)
registrar_.Add(this,
NotificationType::RENDERER_PROCESS_TERMINATED,
NotificationService::AllSources());
-
- BOOL screenreader_running = FALSE;
- if (SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenreader_running, 0) &&
- screenreader_running) {
- render_widget_host_->EnableRendererAccessibility();
- }
}
RenderWidgetHostViewWin::~RenderWidgetHostViewWin() {
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 2135476..d85aa5c 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -582,6 +582,11 @@ const char kFirstRun[] = "first-run";
// current details.
const char kForceFieldTestNameAndValue[] = "force-fieldtest";
+// Force renderer accessibility to be on instead of enabling it on demand when
+// a screen reader is detected. The disable-renderer-accessibility switch
+// overrides this if present.
+const char kForceRendererAccessibility[] = "force-renderer-accessibility";
+
// Extra command line options for launching the GPU process (normally used
// for debugging). Use like renderer-cmd-prefix.
const char kGpuLauncher[] = "gpu-launcher";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 75af5c5..0e37219 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -176,6 +176,7 @@ extern const char kFeedbackServer[];
extern const char kFileDescriptorLimit[];
extern const char kFirstRun[];
extern const char kForceFieldTestNameAndValue[];
+extern const char kForceRendererAccessibility[];
extern const char kGpuLauncher[];
extern const char kGpuProcess[];
extern const char kGpuStartupDialog[];
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index 908df61d..b0808a1 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -287,6 +287,11 @@ void AutomationProxyCacheEntry::CreateProxy(ChromeFrameLaunchParams* params,
if (IsHeadlessMode())
command_line->AppendSwitch(switches::kFullMemoryCrashReport);
+ // In accessible mode automation tests expect renderer accessibility to be
+ // enabled in chrome.
+ if (IsAccessibleMode())
+ command_line->AppendSwitch(switches::kForceRendererAccessibility);
+
DLOG(INFO) << "Profile path: " << params->profile_path().value();
command_line->AppendSwitchPath(switches::kUserDataDir,
params->profile_path());
diff --git a/chrome_frame/chrome_launcher.cc b/chrome_frame/chrome_launcher.cc
index 01cecfc..f040d2b 100644
--- a/chrome_frame/chrome_launcher.cc
+++ b/chrome_frame/chrome_launcher.cc
@@ -22,6 +22,7 @@ const wchar_t* kAllowedSwitches[] = {
L"chrome-frame",
L"disable-renderer-accessibility",
L"enable-experimental-extension-apis",
+ L"force-renderer-accessibility",
L"no-default-browser-check",
L"noerrdialogs",
L"no-first-run",
diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc
index b25b5ae..e00fb14 100644
--- a/chrome_frame/test/run_all_unittests.cc
+++ b/chrome_frame/test/run_all_unittests.cc
@@ -68,18 +68,7 @@ int main(int argc, char **argv) {
}
SetConfigBool(kChromeFrameHeadlessMode, true);
-
- // Pretend that a screenreader is in use to cause Chrome to generate the
- // accessibility tree during page load. Otherwise, Chrome will send back
- // an unpopulated tree for the first request while it fetches the tree
- // from the renderer.
- BOOL is_screenreader_on = FALSE;
- SystemParametersInfo(SPI_SETSCREENREADER, TRUE, NULL, 0);
- SystemParametersInfo(SPI_GETSCREENREADER, 0, &is_screenreader_on, 0);
- if (!is_screenreader_on) {
- LOG(ERROR) << "Could not set screenreader property. Tests depending on "
- << "MSAA in CF will likely fail...";
- }
+ SetConfigBool(kChromeFrameAccessibleMode, true);
base::ProcessHandle crash_service = chrome_frame_test::StartCrashService();
int ret = -1;
@@ -102,6 +91,7 @@ int main(int argc, char **argv) {
}
DeleteConfigValue(kChromeFrameHeadlessMode);
+ DeleteConfigValue(kChromeFrameAccessibleMode);
if (crash_service)
base::KillProcess(crash_service, 0, false);
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 31cf389..e0c40f9 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -72,6 +72,10 @@ const char kAttachExternalTabPrefix[] = "attach_external_tab";
// are handled by the chrome test crash server.
const wchar_t kChromeFrameHeadlessMode[] = L"ChromeFrameHeadlessMode";
+// Indicates that we are running in an environment that expects chrome renderer
+// accessibility to be enabled for use in automation tests.
+const wchar_t kChromeFrameAccessibleMode[] = L"ChromeFrameAccessibleMode";
+
// Indicates that we are running in an environment that wishes to avoid
// DLL pinning, such as the perf tests.
const wchar_t kChromeFrameUnpinnedMode[] = L"kChromeFrameUnpinnedMode";
@@ -943,6 +947,11 @@ bool IsHeadlessMode() {
return headless;
}
+bool IsAccessibleMode() {
+ bool accessible = GetConfigBool(false, kChromeFrameAccessibleMode);
+ return accessible;
+}
+
bool IsUnpinnedMode() {
// We only check this value once and then cache it since changing the registry
// once we've pinned the DLL won't have any effect.
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h
index 0587fdd..0f39d16 100644
--- a/chrome_frame/utils.h
+++ b/chrome_frame/utils.h
@@ -28,6 +28,7 @@ extern const wchar_t kChromeContentPrefix[];
extern const char kGCFProtocol[];
extern const wchar_t kChromeProtocolPrefix[];
extern const wchar_t kChromeFrameHeadlessMode[];
+extern const wchar_t kChromeFrameAccessibleMode[];
extern const wchar_t kChromeFrameUnpinnedMode[];
extern const wchar_t kAllowUnsafeURLs[];
extern const wchar_t kEnableBuggyBhoIntercept[];
@@ -239,6 +240,10 @@ bool DeleteConfigValue(const wchar_t* value_name);
// gather crash dumps, etc to send them to the crash server.
bool IsHeadlessMode();
+// Returns true if we are running in accessible mode in which we need to enable
+// renderer accessibility for use in automation.
+bool IsAccessibleMode();
+
// Returns true if we are running in unpinned mode in which case DLL
// eviction should be possible.
bool IsUnpinnedMode();