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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/string_util_unittest.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 HWND hwnd = window_tracker_->GetResource(handle); 79 HWND hwnd = window_tracker_->GetResource(handle);
80 ::ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE); 80 ::ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE);
81 *result = true; 81 *result = true;
82 } else { 82 } else {
83 *result = false; 83 *result = false;
84 } 84 }
85 } 85 }
86 86
87 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { 87 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) {
88 gfx::NativeWindow window = window_tracker_->GetResource(handle); 88 gfx::NativeWindow window = window_tracker_->GetResource(handle);
89 std::wstring result;
90 int length = ::GetWindowTextLength(window) + 1; 89 int length = ::GetWindowTextLength(window) + 1;
91 ::GetWindowText(window, WriteInto(&result, length), length); 90 if (length > 1)
92 text->assign(WideToUTF16(result)); 91 ::GetWindowText(window, WriteInto(text, length), length);
92 else
93 text->clear();
93 } 94 }
94 95
OLDNEW
« 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