Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: chrome/test/chromedriver/devtools_state.cc

Issue 12093057: [ChromeDriver] Send DOM.getDocument after each DOM.documentUpdated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually uploaded the files Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/chromedriver/devtools_state.cc
diff --git a/chrome/test/chromedriver/devtools_state.cc b/chrome/test/chromedriver/devtools_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c5752e191e5ba8abbb6b300d584381cdcb9edd90
--- /dev/null
+++ b/chrome/test/chromedriver/devtools_state.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/test/chromedriver/devtools_state.h"
+
+#include <utility>
+
+#include "base/json/json_writer.h"
+#include "base/logging.h"
+#include "base/values.h"
+#include "chrome/test/chromedriver/devtools_client.h"
+#include "chrome/test/chromedriver/status.h"
+
+DevToolsState::DevToolsState(DevToolsClient* client)
+ : client_(client) {}
+
+DevToolsState::~DevToolsState() {}
+
+Status DevToolsState::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 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
+ if (status.IsError())
+ return status;
+ // Enable runtime events to allow tracking execution context creation.
+ return client_->SendCommand("Runtime.enable", params);
+}
+
+void DevToolsState::OnEvent(const std::string& method,
+ const base::DictionaryValue& params) {
+ if (method == "DOM.documentUpdated") {
+ base::DictionaryValue params;
+ client_->SendCommand("DOM.getDocument", params);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698