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

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

Issue 10852011: Fixed a bug where pyautolib.cc did not log the automation error message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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) 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_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 &response); 298 &response);
299 } 299 }
300 return response; 300 return response;
301 } 301 }
302 302
303 void PyUITestBase::ErrorResponse( 303 void PyUITestBase::ErrorResponse(
304 const std::string& error_string, 304 const std::string& error_string,
305 const std::string& request, 305 const std::string& request,
306 std::string* response) { 306 std::string* response) {
307 base::DictionaryValue error_dict; 307 base::DictionaryValue error_dict;
308 LOG(ERROR) << "Error during automation: " << *response; 308 std::string error_msg = StringPrintf("%s for %s", error_string.c_str(),
309 error_dict.SetString("error", 309 request.c_str());
310 StringPrintf("%s for %s", 310 LOG(ERROR) << "Error during automation: " << error_msg;
311 error_string.c_str(), 311 error_dict.SetString("error", error_msg);
312 request.c_str()));
313 base::JSONWriter::Write(&error_dict, response); 312 base::JSONWriter::Write(&error_dict, response);
314 } 313 }
315 314
316 void PyUITestBase::RequestFailureResponse( 315 void PyUITestBase::RequestFailureResponse(
317 const std::string& request, 316 const std::string& request,
318 const base::TimeDelta& duration, 317 const base::TimeDelta& duration,
319 const base::TimeDelta& timeout, 318 const base::TimeDelta& timeout,
320 std::string* response) { 319 std::string* response) {
321 // TODO(craigdh): Determine timeout directly from IPC's Send(). 320 // TODO(craigdh): Determine timeout directly from IPC's Send().
322 if (duration >= timeout) { 321 if (duration >= timeout) {
323 ErrorResponse( 322 ErrorResponse(
324 StringPrintf("Request timed out after %d seconds", 323 StringPrintf("Request timed out after %d seconds",
325 static_cast<int>(duration.InSeconds())), 324 static_cast<int>(duration.InSeconds())),
326 request, response); 325 request, response);
327 } else { 326 } else {
328 // TODO(craigdh): Determine specific cause. 327 // TODO(craigdh): Determine specific cause.
329 ErrorResponse("Chrome failed to respond", request, response); 328 ErrorResponse("Chrome failed to respond", request, response);
330 } 329 }
331 } 330 }
332 331
333 bool PyUITestBase::ResetToDefaultTheme() { 332 bool PyUITestBase::ResetToDefaultTheme() {
334 return automation()->ResetToDefaultTheme(); 333 return automation()->ResetToDefaultTheme();
335 } 334 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698