Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp

Issue 1895873006: compositor-worker: Initialize CW machinery plumbing to compositor and fire CW rAF callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bring up oilpan support during compositor worker creation and oilpan the compositor mutator and pro… Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "wtf/OwnPtr.h" 12 #include "wtf/OwnPtr.h"
13 13
14 using ::testing::_; 14 using ::testing::_;
15 15
16 namespace blink { 16 namespace blink {
17 namespace { 17 namespace {
18 18
19 class MockCompositoMutationsTarget : public CompositorMutationsTarget { 19 class MockCompositoMutationsTarget : public CompositorMutationsTarget {
20 public: 20 public:
21 MOCK_METHOD1(applyMutations, void(CompositorMutations*)); 21 MOCK_METHOD1(applyMutations, void(CompositorMutations*));
22 }; 22 };
23 23
24 TEST(CompositorMutatorClient, CallbackForNonNullMutationsShouldApply) 24 TEST(CompositorMutatorClient, CallbackForNonNullMutationsShouldApply)
25 { 25 {
26 MockCompositoMutationsTarget target; 26 MockCompositoMutationsTarget target;
27 27
28 CompositorMutatorClient client(&target); 28 CompositorMutatorClient client(nullptr, &target);
29 OwnPtr<CompositorMutations> mutations = adoptPtr(new CompositorMutations()); 29 OwnPtr<CompositorMutations> mutations = adoptPtr(new CompositorMutations());
30 client.setMutationsForTesting(mutations.release()); 30 client.setMutationsForTesting(mutations.release());
31 31
32 EXPECT_CALL(target, applyMutations(_)); 32 EXPECT_CALL(target, applyMutations(_));
33 client.TakeMutations().Run(); 33 client.TakeMutations().Run();
34 } 34 }
35 35
36 TEST(CompositorMutatorClient, CallbackForNullMutationsShouldBeNoop) 36 TEST(CompositorMutatorClient, CallbackForNullMutationsShouldBeNoop)
37 { 37 {
38 MockCompositoMutationsTarget target; 38 MockCompositoMutationsTarget target;
39 CompositorMutatorClient client(&target); 39 CompositorMutatorClient client(nullptr, &target);
40 40
41 EXPECT_CALL(target, applyMutations(_)).Times(0); 41 EXPECT_CALL(target, applyMutations(_)).Times(0);
42 EXPECT_TRUE(client.TakeMutations().is_null()); 42 EXPECT_TRUE(client.TakeMutations().is_null());
43 } 43 }
44 44
45 } // namespace 45 } // namespace
46 } // namespace blink 46 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698