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

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

Issue 353063005: [ChromeDriver] Subscribe PerformanceLogger to CommandListener interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing unnecessary check in test Created 6 years, 5 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
« no previous file with comments | « chrome/test/chromedriver/command_listener_proxy.cc ('k') | chrome/test/chromedriver/commands.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/command_listener_proxy_unittest.cc
diff --git a/chrome/test/chromedriver/command_listener_proxy_unittest.cc b/chrome/test/chromedriver/command_listener_proxy_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..937605c96aad610b355281d6255fb9992fbbdbc4
--- /dev/null
+++ b/chrome/test/chromedriver/command_listener_proxy_unittest.cc
@@ -0,0 +1,47 @@
+// Copyright 2014 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 <string>
+
+#include "base/compiler_specific.h"
+#include "base/values.h"
+#include "chrome/test/chromedriver/chrome/status.h"
+#include "chrome/test/chromedriver/command_listener_proxy.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+class MockCommandListener : public CommandListener {
+ public:
+ MockCommandListener() : called_(false) {}
+ virtual ~MockCommandListener() {}
+
+ virtual Status BeforeCommand(const std::string& command_name) OVERRIDE {
+ called_ = true;
+ EXPECT_STREQ("cmd", command_name.c_str());
+ return Status(kOk);
+ }
+
+ void VerifyCalled() {
+ EXPECT_TRUE(called_);
+ }
+
+ void VerifyNotCalled() {
+ EXPECT_FALSE(called_);
+ }
+
+ private:
+ bool called_;
+};
+
+} // namespace
+
+TEST(CommandListenerProxy, ForwardsCommands) {
+ MockCommandListener listener;
+ listener.VerifyNotCalled();
+ CommandListenerProxy proxy(&listener);
+ listener.VerifyNotCalled();
+ ASSERT_EQ(kOk, proxy.BeforeCommand("cmd").code());
+ listener.VerifyCalled();
+}
« no previous file with comments | « chrome/test/chromedriver/command_listener_proxy.cc ('k') | chrome/test/chromedriver/commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698