| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/CompositorMutatorClient.h" | 5 #include "platform/graphics/CompositorMutatorClient.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "platform/graphics/CompositorMutation.h" | 8 #include "platform/graphics/CompositorMutation.h" |
| 9 #include "platform/graphics/CompositorMutationsTarget.h" | 9 #include "platform/graphics/CompositorMutationsTarget.h" |
| 10 #include "platform/graphics/CompositorMutator.h" | 10 #include "platform/graphics/CompositorMutator.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class MockCompositoMutationsTarget : public CompositorMutationsTarget { | 31 class MockCompositoMutationsTarget : public CompositorMutationsTarget { |
| 32 public: | 32 public: |
| 33 MOCK_METHOD1(applyMutations, void(CompositorMutations*)); | 33 MOCK_METHOD1(applyMutations, void(CompositorMutations*)); |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 TEST(CompositorMutatorClient, CallbackForNonNullMutationsShouldApply) { | 36 TEST(CompositorMutatorClient, CallbackForNonNullMutationsShouldApply) { |
| 37 MockCompositoMutationsTarget target; | 37 MockCompositoMutationsTarget target; |
| 38 | 38 |
| 39 CompositorMutatorClient client(new StubCompositorMutator, &target); | 39 CompositorMutatorClient client(new StubCompositorMutator, &target); |
| 40 std::unique_ptr<CompositorMutations> mutations = | 40 std::unique_ptr<CompositorMutations> mutations = |
| 41 makeUnique<CompositorMutations>(); | 41 WTF::makeUnique<CompositorMutations>(); |
| 42 client.setMutationsForTesting(std::move(mutations)); | 42 client.setMutationsForTesting(std::move(mutations)); |
| 43 | 43 |
| 44 EXPECT_CALL(target, applyMutations(_)); | 44 EXPECT_CALL(target, applyMutations(_)); |
| 45 client.TakeMutations().Run(); | 45 client.TakeMutations().Run(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 TEST(CompositorMutatorClient, CallbackForNullMutationsShouldBeNoop) { | 48 TEST(CompositorMutatorClient, CallbackForNullMutationsShouldBeNoop) { |
| 49 MockCompositoMutationsTarget target; | 49 MockCompositoMutationsTarget target; |
| 50 CompositorMutatorClient client(new StubCompositorMutator, &target); | 50 CompositorMutatorClient client(new StubCompositorMutator, &target); |
| 51 | 51 |
| 52 EXPECT_CALL(target, applyMutations(_)).Times(0); | 52 EXPECT_CALL(target, applyMutations(_)).Times(0); |
| 53 EXPECT_TRUE(client.TakeMutations().is_null()); | 53 EXPECT_TRUE(client.TakeMutations().is_null()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace | 56 } // namespace |
| 57 } // namespace blink | 57 } // namespace blink |
| OLD | NEW |