1 // Copyright 2014 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.
7 #include "base/compiler_specific.h"
8 #include "base/values.h"
9 #include "chrome/test/chromedriver/chrome/status.h"
10 #include "chrome/test/chromedriver/command_listener_proxy.h"
11 #include "testing/gtest/include/gtest/gtest.h"
15 class MockCommandListener : public CommandListener {
17 MockCommandListener() : called_(false) {}
18 ~MockCommandListener() override {}
20 Status BeforeCommand(const std::string& command_name) override {
22 EXPECT_STREQ("cmd", command_name.c_str());
30 void VerifyNotCalled() {
31 EXPECT_FALSE(called_);
40 TEST(CommandListenerProxy, ForwardsCommands) {
41 MockCommandListener listener;
42 listener.VerifyNotCalled();
43 CommandListenerProxy proxy(&listener);
44 listener.VerifyNotCalled();
45 ASSERT_EQ(kOk, proxy.BeforeCommand("cmd").code());
46 listener.VerifyCalled();