Chromium Code Reviews| Index: chrome/test/chromedriver/dom_tracker.cc |
| diff --git a/chrome/test/chromedriver/dom_tracker.cc b/chrome/test/chromedriver/dom_tracker.cc |
| index bbd36c46f950cb86c54963c49fc2f21c5c7a12cf..49482661b543b9dd856bf8ef1e46144c9b43439f 100644 |
| --- a/chrome/test/chromedriver/dom_tracker.cc |
| +++ b/chrome/test/chromedriver/dom_tracker.cc |
| @@ -11,10 +11,29 @@ |
| #include "base/values.h" |
| #include "chrome/test/chromedriver/status.h" |
| -DomTracker::DomTracker() {} |
| +DomTracker::DomTracker(DevToolsClient* client) |
| + : client_(client) { |
|
kkania
2013/01/30 22:36:05
indent
|
| + DCHECK(client_); |
|
kkania
2013/01/30 22:36:05
indent
|
| +} |
| DomTracker::~DomTracker() {} |
| +Status DomTracker::Init() { |
| + // Perform necessary configuration of the DevTools client. |
| + // Fetch the root document node so that Inspector will push DOM node |
| + // information to the client. |
| + base::DictionaryValue params; |
| + Status status = client_->SendCommand("DOM.getDocument", params); |
| + if (status.IsError()) |
| + return status; |
| + // Enable page domain notifications to allow tracking navigation state. |
| + status = client_->SendCommand("Page.enable", params); |
|
kkania
2013/01/30 22:36:05
oops, i didn't mean to merge Page.enable and Runti
craigdh
2013/01/30 23:05:21
Done.
|
| + if (status.IsError()) |
| + return status; |
| + // Enable runtime events to allow tracking execution context creation. |
| + return client_->SendCommand("Runtime.enable", params); |
| +} |
| + |
| Status DomTracker::GetFrameIdForNode( |
| int node_id, std::string* frame_id) { |
| if (node_to_frame_map_.count(node_id) == 0) |
| @@ -38,6 +57,8 @@ void DomTracker::OnEvent(const std::string& method, |
| } |
| } else if (method == "DOM.documentUpdated") { |
| node_to_frame_map_.clear(); |
| + base::DictionaryValue params; |
| + client_->SendCommand("DOM.getDocument", params); |
| } |
| } |