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

Side by Side Diff: chrome/test/pyautolib/pyautolib.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/json/json_writer.h" 6 #include "base/json/json_writer.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 return response; 128 return response;
129 } 129 }
130 130
131 void PyUITestBase::ErrorResponse( 131 void PyUITestBase::ErrorResponse(
132 const std::string& error_string, 132 const std::string& error_string,
133 const std::string& request, 133 const std::string& request,
134 bool is_timeout, 134 bool is_timeout,
135 std::string* response) { 135 std::string* response) {
136 base::DictionaryValue error_dict; 136 base::DictionaryValue error_dict;
137 std::string error_msg = StringPrintf("%s for %s", error_string.c_str(), 137 std::string error_msg = base::StringPrintf("%s for %s", error_string.c_str(),
138 request.c_str()); 138 request.c_str());
139 LOG(ERROR) << "Error during automation: " << error_msg; 139 LOG(ERROR) << "Error during automation: " << error_msg;
140 error_dict.SetString("error", error_msg); 140 error_dict.SetString("error", error_msg);
141 error_dict.SetBoolean("is_interface_error", true); 141 error_dict.SetBoolean("is_interface_error", true);
142 error_dict.SetBoolean("is_interface_timeout", is_timeout); 142 error_dict.SetBoolean("is_interface_timeout", is_timeout);
143 base::JSONWriter::Write(&error_dict, response); 143 base::JSONWriter::Write(&error_dict, response);
144 } 144 }
145 145
146 void PyUITestBase::RequestFailureResponse( 146 void PyUITestBase::RequestFailureResponse(
147 const std::string& request, 147 const std::string& request,
148 const base::TimeDelta& duration, 148 const base::TimeDelta& duration,
149 const base::TimeDelta& timeout, 149 const base::TimeDelta& timeout,
150 std::string* response) { 150 std::string* response) {
151 // TODO(craigdh): Determine timeout directly from IPC's Send(). 151 // TODO(craigdh): Determine timeout directly from IPC's Send().
152 if (duration >= timeout) { 152 if (duration >= timeout) {
153 ErrorResponse( 153 ErrorResponse(
154 StringPrintf("Chrome automation timed out after %d seconds", 154 base::StringPrintf("Chrome automation timed out after %d seconds",
155 static_cast<int>(duration.InSeconds())), 155 static_cast<int>(duration.InSeconds())),
156 request, true, response); 156 request, true, response);
157 } else { 157 } else {
158 // TODO(craigdh): Determine specific cause. 158 // TODO(craigdh): Determine specific cause.
159 ErrorResponse( 159 ErrorResponse(
160 "Chrome automation failed prior to timing out, did chrome crash?", 160 "Chrome automation failed prior to timing out, did chrome crash?",
161 request, false, response); 161 request, false, response);
162 } 162 }
163 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698