OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "content/public/browser/devtools_agent_host.h" | 10 #include "content/public/browser/devtools_agent_host.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 protected: | 32 protected: |
33 void SendCommand(const std::string& method, | 33 void SendCommand(const std::string& method, |
34 scoped_ptr<base::DictionaryValue> params) { | 34 scoped_ptr<base::DictionaryValue> params) { |
35 base::DictionaryValue command; | 35 base::DictionaryValue command; |
36 command.SetInteger(kIdParam, 1); | 36 command.SetInteger(kIdParam, 1); |
37 command.SetString(kMethodParam, method); | 37 command.SetString(kMethodParam, method); |
38 if (params) | 38 if (params) |
39 command.Set(kParamsParam, params.release()); | 39 command.Set(kParamsParam, params.release()); |
40 | 40 |
41 std::string json_command; | 41 std::string json_command; |
42 base::JSONWriter::Write(&command, &json_command); | 42 base::JSONWriter::Write(command, &json_command); |
43 agent_host_->DispatchProtocolMessage(json_command); | 43 agent_host_->DispatchProtocolMessage(json_command); |
44 base::MessageLoop::current()->Run(); | 44 base::MessageLoop::current()->Run(); |
45 } | 45 } |
46 | 46 |
47 bool HasValue(const std::string& path) { | 47 bool HasValue(const std::string& path) { |
48 base::Value* value = 0; | 48 base::Value* value = 0; |
49 return result_->Get(path, &value); | 49 return result_->Get(path, &value); |
50 } | 50 } |
51 | 51 |
52 bool HasListItem(const std::string& path_to_list, | 52 bool HasListItem(const std::string& path_to_list, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // new value of |document.body.scrollTop| will depend on the screen dimensions | 255 // new value of |document.body.scrollTop| will depend on the screen dimensions |
256 // of the device that we're testing on, but in any case it should be greater | 256 // of the device that we're testing on, but in any case it should be greater |
257 // than 0. | 257 // than 0. |
258 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( | 258 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
259 shell()->web_contents(), | 259 shell()->web_contents(), |
260 "domAutomationController.send(document.body.scrollTop)", &scroll_top)); | 260 "domAutomationController.send(document.body.scrollTop)", &scroll_top)); |
261 ASSERT_GT(scroll_top, 0); | 261 ASSERT_GT(scroll_top, 0); |
262 } | 262 } |
263 | 263 |
264 } // namespace content | 264 } // namespace content |
OLD | NEW |