diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-11 22:41:43 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-11 22:41:43 +0000 |
commit | f6ff0dfd962666d79e4919e23c0078283fed2922 (patch) | |
tree | 88a7462b11dc1463ef7cc728ccabaf7012cb188d /chrome/browser/automation/automation_provider_json.cc | |
parent | b3839a6adf2c4ec9572852577b2c270b9266820a (diff) | |
download | chromium_src-f6ff0dfd962666d79e4919e23c0078283fed2922.zip chromium_src-f6ff0dfd962666d79e4919e23c0078283fed2922.tar.gz chromium_src-f6ff0dfd962666d79e4919e23c0078283fed2922.tar.bz2 |
Revert 52054: causing startup tests to fail on Vista and XP perf dbg
Revert 52054 - Refactor json automation interface for pyauto hooks.
Reduces the number of lines you need to add per new automation hook. Shaves
off several lines of code.
Refactor pyauto.py to obviate raising exception in case the json interfaces produces an error string.
Review URL: http://codereview.chromium.org/2898001
TBR=nirnimesh@chromium.org
Review URL: http://codereview.chromium.org/2977001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52067 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_provider_json.cc')
-rw-r--r-- | chrome/browser/automation/automation_provider_json.cc | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/chrome/browser/automation/automation_provider_json.cc b/chrome/browser/automation/automation_provider_json.cc deleted file mode 100644 index 3cfd5e6..0000000 --- a/chrome/browser/automation/automation_provider_json.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/automation/automation_provider_json.h" - -#include "base/json/json_writer.h" -#include "base/json/string_escape.h" -#include "chrome/test/automation/automation_messages.h" - - -AutomationJSONReply::AutomationJSONReply(AutomationProvider* provider, - IPC::Message* reply_message) - : provider_(provider), - message_(reply_message) { -} - -AutomationJSONReply::~AutomationJSONReply() { - DCHECK(!message_) << "JSON automation request not replied!"; -} - -void AutomationJSONReply::SendSuccess(const Value* value) { - DCHECK(message_) << "Resending reply for JSON automation request"; - std::string json_string = "{}"; - if (value) - base::JSONWriter::Write(value, false, &json_string); - AutomationMsg_SendJSONRequest::WriteReplyParams( - message_, json_string, true); - provider_->Send(message_); - message_ = NULL; -} - -void AutomationJSONReply::SendError(const std::string& error_mesg) { - DCHECK(message_) << "Resending reply for JSON automation request"; - std::string json_string = JSONErrorString(error_mesg); - AutomationMsg_SendJSONRequest::WriteReplyParams( - message_, json_string, false); - provider_->Send(message_); - message_ = NULL; -} - -/* static */ -std::string AutomationJSONReply::JSONErrorString(const std::string& err) { - std::string prefix = "{\"error\": \""; - std::string no_quote_err; - std::string suffix = "\"}"; - - base::JsonDoubleQuote(err, false, &no_quote_err); - return prefix + no_quote_err + suffix; -} - |