summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/testing_automation_provider_win.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/browser/automation/testing_automation_provider_win.cc b/chrome/browser/automation/testing_automation_provider_win.cc
index 424aa39..21d2137 100644
--- a/chrome/browser/automation/testing_automation_provider_win.cc
+++ b/chrome/browser/automation/testing_automation_provider_win.cc
@@ -86,9 +86,10 @@ void TestingAutomationProvider::SetWindowVisible(int handle,
void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) {
gfx::NativeWindow window = window_tracker_->GetResource(handle);
- std::wstring result;
int length = ::GetWindowTextLength(window) + 1;
- ::GetWindowText(window, WriteInto(&result, length), length);
- text->assign(WideToUTF16(result));
+ if (length > 1)
+ ::GetWindowText(window, WriteInto(text, length), length);
+ else
+ text->clear();
}