// Copyright 2009 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // This test is a simple sanity check to make sure gmock is able to build/link // correctly. It just instantiates a mock object and runs through a couple of // the basic mock features. #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" // Gmock matchers and actions that we use below. AnyOf; Eq; Return; SetArgPointee; WithArg; _; namespace { // Simple class that we can mock out the behavior for. Everything is virtual // for easy mocking. class SampleClass { … }; // Declare a mock for the class. class MockSampleClass : public SampleClass { … }; // Create a couple of custom actions. Custom actions can be used for adding // more complex behavior into your mock...though if you start needing these, ask // if you're asking your mock to do too much. ACTION(ReturnVal) { … } ACTION(ReturnSecond) { … } TEST(GmockTest, SimpleMatchAndActions) { … } TEST(GmockTest, AssignArgument) { … } TEST(GmockTest, SideEffects) { … } TEST(GmockTest, CustomAction_ReturnSecond) { … } TEST(GmockTest, CustomAction_ReturnVal) { … } } // namespace