blob: f56b398f271dc1a3a6e3b97bdd53530dd076d4e4 [file] [log] [blame]
// Copyright 2019 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 "base/macros.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class JSCallsContainer;
// Enables setting up expectations for incoming and outgoing JavaScript in
// OOBE/login. When constructed this automatically enables event recording;
// JavaScript messages from before this is constructed may not be captured.
// Messages are automatically dispatched to the mocks in the destructor.
class JSCallsContainerTestApi {
explicit JSCallsContainerTestApi(JSCallsContainer* js_calls_container);
// |function| has arguments serialized to make matching easier. For example, a
// valid invocation looks like
// EXPECT_CALL(test_api,
// Outgoing("login.MyComponent.setUpdateRequired(true, 5)"));
// Notification from WebUI to C++
MOCK_METHOD1(Incoming, void(std::string function));
// Notification from C++ to WebUI
MOCK_METHOD1(Outgoing, void(std::string function));
JSCallsContainer* const js_calls_container_;
} // namespace chromeos