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 3 // found in the LICENSE file. 4 5 #include "chrome/common/automation_constants.h" 6 7 namespace automation { 8 9 // JSON value labels for proxy settings that are passed in via 10 // AutomationMsg_SetProxyConfig. 11 const char kJSONProxyAutoconfig[] = "proxy.autoconfig"; 12 const char kJSONProxyNoProxy[] = "proxy.no_proxy"; 13 const char kJSONProxyPacUrl[] = "proxy.pac_url"; 14 const char kJSONProxyPacMandatory[] = "proxy.pac_mandatory"; 15 const char kJSONProxyBypassList[] = "proxy.bypass_list"; 16 const char kJSONProxyServer[] = "proxy.server"; 17 18 // Named testing interface is used when you want to connect an 19 // AutomationProxy to an already-running browser instance. 20 const char kNamedInterfacePrefix[] = "NamedTestingInterface:"; 21 22 const int kChromeDriverAutomationVersion = 1; 23 24 namespace { 25 26 // Returns the string equivalent of the given |ErrorCode|. 27 const char* DefaultMessageForErrorCode(ErrorCode code) { 28 switch (code) { 29 case kUnknownError: 30 return "Unknown error"; 31 case kNoJavaScriptModalDialogOpen: 32 return "No JavaScript modal dialog is open"; 33 case kBlockedByModalDialog: 34 return "Command blocked by an open modal dialog"; 35 case kInvalidId: 36 return "ID is invalid or does not refer to an existing object"; 37 default: 38 return "<unknown>"; 39 } 40 } 41 42 } // namespace 43 44 Error::Error() : code_(kUnknownError) { } 45 46 Error::Error(ErrorCode code) 47 : code_(code), 48 message_(DefaultMessageForErrorCode(code)) { } 49 50 Error::Error(const std::string& error_msg) 51 : code_(kUnknownError), message_(error_msg) { } 52 53 Error::Error(ErrorCode code, const std::string& error_msg) 54 : code_(code), message_(error_msg) { } 55 56 Error::~Error() { } 57 58 ErrorCode Error::code() const { 59 return code_; 60 } 61 62 const std::string& Error::message() const { 63 return message_; 64 } 65 66 } // namespace automation 67