OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #include "platform/graphics/CompositorMutatorClient.h" |
| 6 |
| 7 #include "base/callback.h" |
| 8 #include "platform/graphics/CompositorMutation.h" |
| 9 #include "platform/graphics/CompositorMutationsTarget.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "wtf/OwnPtr.h" |
| 13 |
| 14 using ::testing::_; |
| 15 |
| 16 namespace blink { |
| 17 namespace { |
| 18 |
| 19 class MockCompositoMutationsTarget : public CompositorMutationsTarget { |
| 20 public: |
| 21 MOCK_METHOD1(applyMutations, void(CompositorMutations*)); |
| 22 }; |
| 23 |
| 24 TEST(CompositorMutatorClient, CallbackForNonNullMutationsShouldApply) |
| 25 { |
| 26 MockCompositoMutationsTarget target; |
| 27 |
| 28 CompositorMutatorClient client(&target); |
| 29 OwnPtr<CompositorMutations> mutations = adoptPtr(new CompositorMutations()); |
| 30 client.setMutationsForTesting(mutations.release()); |
| 31 |
| 32 EXPECT_CALL(target, applyMutations(_)); |
| 33 client.TakeMutations().Run(); |
| 34 } |
| 35 |
| 36 TEST(CompositorMutatorClient, CallbackForNullMutationsShouldBeNoop) |
| 37 { |
| 38 MockCompositoMutationsTarget target; |
| 39 CompositorMutatorClient client(&target); |
| 40 |
| 41 EXPECT_CALL(target, applyMutations(_)).Times(0); |
| 42 EXPECT_TRUE(client.TakeMutations().is_null()); |
| 43 } |
| 44 |
| 45 } // namespace |
| 46 } // namespace blink |
OLD | NEW |