OLD | NEW |
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 <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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 virtual Status SendCommandAndGetResult( | 89 virtual Status SendCommandAndGetResult( |
90 const std::string& method, | 90 const std::string& method, |
91 const base::DictionaryValue& params, | 91 const base::DictionaryValue& params, |
92 scoped_ptr<base::DictionaryValue>* result) OVERRIDE { | 92 scoped_ptr<base::DictionaryValue>* result) OVERRIDE { |
93 if (status_.IsError()) | 93 if (status_.IsError()) |
94 return status_; | 94 return status_; |
95 result->reset(result_.DeepCopy()); | 95 result->reset(result_.DeepCopy()); |
96 return Status(kOk); | 96 return Status(kOk); |
97 } | 97 } |
| 98 virtual void AddListener(DevToolsEventListener* listener) OVERRIDE {} |
98 | 99 |
99 private: | 100 private: |
100 Status status_; | 101 Status status_; |
101 base::DictionaryValue result_; | 102 base::DictionaryValue result_; |
102 }; | 103 }; |
103 | 104 |
104 void AssertEvalFails(const base::DictionaryValue& command_result) { | 105 void AssertEvalFails(const base::DictionaryValue& command_result) { |
105 scoped_ptr<base::DictionaryValue> result; | 106 scoped_ptr<base::DictionaryValue> result; |
106 FakeDevToolsClient client; | 107 FakeDevToolsClient client; |
107 client.set_result(command_result); | 108 client.set_result(command_result); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 FakeDevToolsClient client; | 227 FakeDevToolsClient client; |
227 base::DictionaryValue dict; | 228 base::DictionaryValue dict; |
228 dict.SetBoolean("wasThrown", false); | 229 dict.SetBoolean("wasThrown", false); |
229 dict.SetString("result.objectId", "id"); | 230 dict.SetString("result.objectId", "id"); |
230 client.set_result(dict); | 231 client.set_result(dict); |
231 std::string object_id; | 232 std::string object_id; |
232 ASSERT_TRUE(internal::EvaluateScriptAndGetObject( | 233 ASSERT_TRUE(internal::EvaluateScriptAndGetObject( |
233 &client, 0, "", &object_id).IsOk()); | 234 &client, 0, "", &object_id).IsOk()); |
234 ASSERT_STREQ("id", object_id.c_str()); | 235 ASSERT_STREQ("id", object_id.c_str()); |
235 } | 236 } |
OLD | NEW |