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

Unified Diff: chrome/browser/browser_focus_uitest.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, 2 months 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
Index: chrome/browser/browser_focus_uitest.cc
===================================================================
--- chrome/browser/browser_focus_uitest.cc (revision 107404)
+++ chrome/browser/browser_focus_uitest.cc (working copy)
@@ -90,7 +90,8 @@
std::wstring caption;
std::wstring filename;
int len = ::GetWindowTextLength(window) + 1;
- ::GetWindowText(window, WriteInto(&caption, len), len);
+ if (len > 1)
+ ::GetWindowText(window, WriteInto(&caption, len), len);
bool chrome_window_in_foreground =
EndsWith(caption, L" - Google Chrome", true) ||
EndsWith(caption, L" - Chromium", true);
@@ -102,8 +103,8 @@
if (base::OpenProcessHandleWithAccess(process_id,
PROCESS_QUERY_LIMITED_INFORMATION,
&process)) {
- len = MAX_PATH;
- if (!GetProcessImageFileName(process, WriteInto(&filename, len), len)) {
+ if (!GetProcessImageFileName(process, WriteInto(&filename, MAX_PATH),
+ MAX_PATH)) {
int error = GetLastError();
filename = std::wstring(L"Unable to read filename for process id '" +
base::IntToString16(process_id) +

Powered by Google App Engine
This is Rietveld 408576698