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

Unified Diff: chrome/test/chromedriver/devtools_state_unittest.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_unittest.cc
diff --git a/chrome/test/chromedriver/devtools_state_unittest.cc b/chrome/test/chromedriver/devtools_state_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4534045daf046f54dbf165aaff6bb6f5659b51e5
--- /dev/null
+++ b/chrome/test/chromedriver/devtools_state_unittest.cc
@@ -0,0 +1,66 @@
+// 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 <list>
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "chrome/test/chromedriver/devtools_client.h"
+#include "chrome/test/chromedriver/devtools_state.h"
+#include "chrome/test/chromedriver/status.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+class FakeDevToolsClient : public DevToolsClient {
+ public:
+ FakeDevToolsClient() : send_count_(0) {}
+ virtual ~FakeDevToolsClient() {}
+
+ int GetSendCount() {
+ return send_count_;
+ }
+
+ // Overridden from DevToolsClient:
+ virtual Status SendCommand(const std::string& method,
+ const base::DictionaryValue& params) OVERRIDE {
+ ++send_count_;
+ return Status(kOk);
+ }
+ virtual Status SendCommandAndGetResult(
+ const std::string& method,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::DictionaryValue>* result) OVERRIDE {
+ ++send_count_;
+ return Status(kOk);
+ }
+ virtual void AddListener(DevToolsEventListener* listener) OVERRIDE {}
+ virtual Status HandleEventsUntil(
+ const ConditionalFunc& conditional_func) OVERRIDE {
+ return Status(kOk);
+ }
+
+ private:
kkania 2013/01/30 18:50:29 bad indent
craigdh 2013/01/30 22:20:04 Done.
+ int send_count_;
+};
+
+} // namespace
+
+TEST(DevToolsState, Init) {
+ FakeDevToolsClient client;
+ DevToolsState state(&client);
+ base::DictionaryValue params;
+ state.Init();
+ ASSERT_EQ(client.GetSendCount(), 3);
kkania 2013/01/30 18:50:29 this is brittle and I'm not sure is very helpful.
craigdh 2013/01/30 22:20:04 Done.
+}
+
+TEST(DevToolsState, OnEvent) {
+ FakeDevToolsClient client;
+ DevToolsState state(&client);
+ base::DictionaryValue params;
+ state.OnEvent("DOM.documentUpdated", params);
+ ASSERT_EQ(client.GetSendCount(), 1);
+}
« chrome/test/chromedriver/devtools_state.cc ('K') | « chrome/test/chromedriver/devtools_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698