Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: chrome/browser/automation/testing_automation_provider_win.cc

Issue 8418034: Make string_util::WriteInto() DCHECK() that the supplied |length_with_null| > 1, meaning that the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/string_util_unittest.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/testing_automation_provider_win.cc
===================================================================
--- chrome/browser/automation/testing_automation_provider_win.cc (revision 111826)
+++ chrome/browser/automation/testing_automation_provider_win.cc (working copy)
@@ -86,9 +86,10 @@
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();
}
« no previous file with comments | « base/string_util_unittest.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698