Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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/test/chromedriver/devtools_state.h" | |
| 6 | |
| 7 #include <utility> | |
| 8 | |
| 9 #include "base/json/json_writer.h" | |
| 10 #include "base/logging.h" | |
| 11 #include "base/values.h" | |
| 12 #include "chrome/test/chromedriver/devtools_client.h" | |
| 13 #include "chrome/test/chromedriver/status.h" | |
| 14 | |
| 15 DevToolsState::DevToolsState(DevToolsClient* client) | |
| 16 : client_(client) {} | |
| 17 | |
| 18 DevToolsState::~DevToolsState() {} | |
| 19 | |
| 20 Status DevToolsState::Init() { | |
| 21 // Perform necessary configuration of the DevTools client. | |
| 22 // Fetch the root document node so that Inspector will push DOM node | |
| 23 // information to the client. | |
| 24 base::DictionaryValue params; | |
| 25 Status status = client_->SendCommand("DOM.getDocument", params); | |
| 26 if (status.IsError()) | |
| 27 return status; | |
| 28 // Enable page domain notifications to allow tracking navigation state. | |
| 29 status = client_->SendCommand("Page.enable", params); | |
|
kkania
2013/01/30 18:50:29
So actually, Page.enable and Runtime.enable only n
kkania
2013/01/30 20:33:24
Wait nevermind, this is only done once per connect
craigdh
2013/01/30 21:35:08
Ok, I'll just fold this class's functionality into
| |
| 30 if (status.IsError()) | |
| 31 return status; | |
| 32 // Enable runtime events to allow tracking execution context creation. | |
| 33 return client_->SendCommand("Runtime.enable", params); | |
| 34 } | |
| 35 | |
| 36 void DevToolsState::OnEvent(const std::string& method, | |
| 37 const base::DictionaryValue& params) { | |
| 38 if (method == "DOM.documentUpdated") { | |
| 39 base::DictionaryValue params; | |
| 40 client_->SendCommand("DOM.getDocument", params); | |
| 41 } | |
| 42 } | |
| OLD | NEW |