| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <list> | 5 #include <list> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 void set_status(const Status& status) { | 23 void set_status(const Status& status) { |
| 24 status_ = status; | 24 status_ = status; |
| 25 } | 25 } |
| 26 void set_result(const base::DictionaryValue& result) { | 26 void set_result(const base::DictionaryValue& result) { |
| 27 result_.Clear(); | 27 result_.Clear(); |
| 28 result_.MergeDictionary(&result); | 28 result_.MergeDictionary(&result); |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Overridden from DevToolsClient: | 31 // Overridden from DevToolsClient: |
| 32 virtual Status ConnectIfNecessary() OVERRIDE { |
| 33 return Status(kOk); |
| 34 } |
| 32 virtual Status SendCommand(const std::string& method, | 35 virtual Status SendCommand(const std::string& method, |
| 33 const base::DictionaryValue& params) OVERRIDE { | 36 const base::DictionaryValue& params) OVERRIDE { |
| 34 return SendCommandAndGetResult(method, params, NULL); | 37 return SendCommandAndGetResult(method, params, NULL); |
| 35 } | 38 } |
| 36 virtual Status SendCommandAndGetResult( | 39 virtual Status SendCommandAndGetResult( |
| 37 const std::string& method, | 40 const std::string& method, |
| 38 const base::DictionaryValue& params, | 41 const base::DictionaryValue& params, |
| 39 scoped_ptr<base::DictionaryValue>* result) OVERRIDE { | 42 scoped_ptr<base::DictionaryValue>* result) OVERRIDE { |
| 40 if (status_.IsError()) | 43 if (status_.IsError()) |
| 41 return status_; | 44 return status_; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 193 |
| 191 TEST(ParseCallFunctionResult, ScriptError) { | 194 TEST(ParseCallFunctionResult, ScriptError) { |
| 192 scoped_ptr<base::Value> result; | 195 scoped_ptr<base::Value> result; |
| 193 base::DictionaryValue dict; | 196 base::DictionaryValue dict; |
| 194 dict.SetInteger("status", 1); | 197 dict.SetInteger("status", 1); |
| 195 dict.SetInteger("value", 1); | 198 dict.SetInteger("value", 1); |
| 196 Status status = internal::ParseCallFunctionResult(dict, &result); | 199 Status status = internal::ParseCallFunctionResult(dict, &result); |
| 197 ASSERT_EQ(1, status.code()); | 200 ASSERT_EQ(1, status.code()); |
| 198 ASSERT_FALSE(result); | 201 ASSERT_FALSE(result); |
| 199 } | 202 } |
| OLD | NEW |