summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/testing_automation_provider_win.cc
diff options
context:
space:
mode:
authorbruening@google.com <bruening@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 18:46:28 +0000
committerbruening@google.com <bruening@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 18:46:28 +0000
commitd09efe9d444bfcfe766ffac348b7950174dc8784 (patch)
treeeaf2068b3dbf66540df81d5c1ebe88de18c7588c /chrome/browser/automation/testing_automation_provider_win.cc
parentb60de2fb0d575840bc961259f47b6dfaeea7568e (diff)
downloadchromium_src-d09efe9d444bfcfe766ffac348b7950174dc8784.zip
chromium_src-d09efe9d444bfcfe766ffac348b7950174dc8784.tar.gz
chromium_src-d09efe9d444bfcfe766ffac348b7950174dc8784.tar.bz2
Set WINDOWPLACEMENT.length before calling GetWindowPlacement()
Also check return value of GetWindowPlacement() BUG=95538 TEST=Dr. Memory no longer reports errors on PreferenceServiceTest.PreservedWindowPlacementIsMigrated Review URL: http://codereview.chromium.org/7847025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/testing_automation_provider_win.cc')
-rw-r--r--chrome/browser/automation/testing_automation_provider_win.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/automation/testing_automation_provider_win.cc b/chrome/browser/automation/testing_automation_provider_win.cc
index 98e4e84..424aa39 100644
--- a/chrome/browser/automation/testing_automation_provider_win.cc
+++ b/chrome/browser/automation/testing_automation_provider_win.cc
@@ -25,10 +25,12 @@ void TestingAutomationProvider::IsWindowMaximized(int handle,
HWND hwnd = window_tracker_->GetResource(handle);
if (hwnd) {
- *success = true;
WINDOWPLACEMENT window_placement;
- GetWindowPlacement(hwnd, &window_placement);
- *is_maximized = (window_placement.showCmd == SW_MAXIMIZE);
+ window_placement.length = sizeof(window_placement);
+ if (GetWindowPlacement(hwnd, &window_placement)) {
+ *success = true;
+ *is_maximized = (window_placement.showCmd == SW_MAXIMIZE);
+ }
}
}
@@ -48,10 +50,12 @@ void TestingAutomationProvider::GetWindowBounds(int handle,
*success = false;
HWND hwnd = window_tracker_->GetResource(handle);
if (hwnd) {
- *success = true;
WINDOWPLACEMENT window_placement;
- GetWindowPlacement(hwnd, &window_placement);
- *bounds = window_placement.rcNormalPosition;
+ window_placement.length = sizeof(window_placement);
+ if (GetWindowPlacement(hwnd, &window_placement)) {
+ *success = true;
+ *bounds = window_placement.rcNormalPosition;
+ }
}
}