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

Side by Side Diff: chrome/test/webdriver/commands/response.cc

Issue 6705004: Return the full cookie details in TestingAutomationProvider and pass around (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 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) 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/test/webdriver/commands/response.h" 5 #include "chrome/test/webdriver/commands/response.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
11 namespace webdriver { 11 namespace webdriver {
12 12
13 namespace { 13 namespace {
14 14
15 // Error message taken from: 15 // Error message taken from:
16 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#Response_Status_Codes 16 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#Response_Status_Codes
17 const char* const kStatusKey = "status"; 17 const char* const kStatusKey = "status";
18 const char* const kValueKey = "value"; 18 const char* const kValueKey = "value";
19 const char* const kMessageKey = "message"; 19 const char* const kMessageKey = "message";
20 const char* const kScreenKey = "screen"; 20 const char* const kScreenKey = "screen";
21 const char* const kClassKey = "class"; 21 const char* const kClassKey = "class";
22 const char* const kStackTraceFileNameKey = "stackTrace.fileName"; 22 const char* const kStackTraceKey = "stackTrace";
23 const char* const kStackTraceLineNumberKey = "stackTrace.lineNumber"; 23 const char* const kStackTraceFileNameKey = "fileName";
24 const char* const kStackTraceClassNameKey = "className";
25 const char* const kStackTraceMethodNameKey = "methodName";
26 const char* const kStackTraceLineNumberKey = "lineNumber";
24 27
25 } // namespace 28 } // namespace
26 29
27 Response::Response() { 30 Response::Response() {
28 SetStatus(kSuccess); 31 SetStatus(kSuccess);
29 SetValue(new DictionaryValue()); 32 SetValue(new DictionaryValue());
30 } 33 }
31 34
32 Response::~Response() {} 35 Response::~Response() {}
33 36
(...skipping 16 matching lines...) Expand all
50 } 53 }
51 54
52 void Response::SetValue(Value* value) { 55 void Response::SetValue(Value* value) {
53 data_.Set(kValueKey, value); 56 data_.Set(kValueKey, value);
54 } 57 }
55 58
56 void Response::SetError(ErrorCode error_code, const std::string& message, 59 void Response::SetError(ErrorCode error_code, const std::string& message,
57 const std::string& file, int line) { 60 const std::string& file, int line) {
58 DictionaryValue* error = new DictionaryValue; 61 DictionaryValue* error = new DictionaryValue;
59 error->SetString(kMessageKey, message); 62 error->SetString(kMessageKey, message);
60 error->SetString(kStackTraceFileNameKey, file); 63
61 error->SetInteger(kStackTraceLineNumberKey, line); 64 DictionaryValue* stack = new DictionaryValue;
65 stack->SetString(kStackTraceFileNameKey, file);
66 stack->SetString(kStackTraceClassNameKey, "");
67 stack->SetString(kStackTraceMethodNameKey, "");
68 stack->SetInteger(kStackTraceLineNumberKey, line);
69 ListValue* stack_list = new ListValue;
70 stack_list->Append(stack);
71 error->Set(kStackTraceKey, stack_list);
62 72
63 SetStatus(error_code); 73 SetStatus(error_code);
64 SetValue(error); 74 SetValue(error);
65 } 75 }
66 76
67 void Response::SetField(const std::string& key, Value* value) { 77 void Response::SetField(const std::string& key, Value* value) {
68 data_.Set(key, value); 78 data_.Set(key, value);
69 } 79 }
70 80
71 std::string Response::ToJSON() const { 81 std::string Response::ToJSON() const {
72 std::string json; 82 std::string json;
73 base::JSONWriter::Write(&data_, false, &json); 83 base::JSONWriter::Write(&data_, false, &json);
74 return json; 84 return json;
75 } 85 }
76 86
77 } // namespace webdriver 87 } // namespace webdriver
78
OLDNEW
« no previous file with comments | « chrome/test/webdriver/commands/cookie_commands.cc ('k') | chrome/test/webdriver/commands/session_with_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698