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

Side by Side Diff: cc/nine_patch_layer_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month 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
« no previous file with comments | « cc/nine_patch_layer_impl_unittest.cc ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/nine_patch_layer.h" 7 #include "cc/nine_patch_layer.h"
8 8
9 #include "cc/layer_tree_host.h" 9 #include "cc/layer_tree_host.h"
10 #include "cc/occlusion_tracker.h" 10 #include "cc/occlusion_tracker.h"
(...skipping 17 matching lines...) Expand all
28 using ::testing::AtLeast; 28 using ::testing::AtLeast;
29 using ::testing::AnyNumber; 29 using ::testing::AnyNumber;
30 30
31 namespace { 31 namespace {
32 32
33 class MockLayerTreeHost : public LayerTreeHost { 33 class MockLayerTreeHost : public LayerTreeHost {
34 public: 34 public:
35 MockLayerTreeHost() 35 MockLayerTreeHost()
36 : LayerTreeHost(&m_fakeClient, LayerTreeSettings()) 36 : LayerTreeHost(&m_fakeClient, LayerTreeSettings())
37 { 37 {
38 initialize(); 38 initialize(scoped_ptr<Thread>(NULL));
39 } 39 }
40 40
41 private: 41 private:
42 FakeLayerImplTreeHostClient m_fakeClient; 42 FakeLayerImplTreeHostClient m_fakeClient;
43 }; 43 };
44 44
45 45
46 class NinePatchLayerTest : public testing::Test { 46 class NinePatchLayerTest : public testing::Test {
47 public: 47 public:
48 NinePatchLayerTest() 48 NinePatchLayerTest()
49 { 49 {
50 } 50 }
51 51
52 Proxy* proxy() const { return m_layerTreeHost->proxy(); }
53
52 protected: 54 protected:
53 virtual void SetUp() 55 virtual void SetUp()
54 { 56 {
55 m_layerTreeHost.reset(new MockLayerTreeHost); 57 m_layerTreeHost.reset(new MockLayerTreeHost);
56 } 58 }
57 59
58 virtual void TearDown() 60 virtual void TearDown()
59 { 61 {
60 Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); 62 Mock::VerifyAndClearExpectations(m_layerTreeHost.get());
61 } 63 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ResourceUpdate params = queue.takeFirstFullUpload(); 101 ResourceUpdate params = queue.takeFirstFullUpload();
100 EXPECT_TRUE(params.texture != NULL); 102 EXPECT_TRUE(params.texture != NULL);
101 103
102 // Upload the texture. 104 // Upload the texture.
103 m_layerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(1024 * 102 4); 105 m_layerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(1024 * 102 4);
104 m_layerTreeHost->contentsTextureManager()->prioritizeTextures(); 106 m_layerTreeHost->contentsTextureManager()->prioritizeTextures();
105 107
106 scoped_ptr<GraphicsContext> context; 108 scoped_ptr<GraphicsContext> context;
107 scoped_ptr<ResourceProvider> resourceProvider; 109 scoped_ptr<ResourceProvider> resourceProvider;
108 { 110 {
109 DebugScopedSetImplThread implThread; 111 DebugScopedSetImplThread implThread(proxy());
110 DebugScopedSetMainThreadBlocked mainThreadBlocked; 112 DebugScopedSetMainThreadBlocked mainThreadBlocked(proxy());
111 context = WebKit::createFakeGraphicsContext(); 113 context = WebKit::createFakeGraphicsContext();
112 resourceProvider = ResourceProvider::create(context.get()); 114 resourceProvider = ResourceProvider::create(context.get());
113 params.texture->acquireBackingTexture(resourceProvider.get()); 115 params.texture->acquireBackingTexture(resourceProvider.get());
114 ASSERT_TRUE(params.texture->haveBackingTexture()); 116 ASSERT_TRUE(params.texture->haveBackingTexture());
115 } 117 }
116 118
117 // Nothing changed, so no repeated upload. 119 // Nothing changed, so no repeated upload.
118 testLayer->setTexturePriorities(calculator); 120 testLayer->setTexturePriorities(calculator);
119 testLayer->update(queue, &occlusionTracker, stats); 121 testLayer->update(queue, &occlusionTracker, stats);
120 EXPECT_EQ(queue.fullUploadSize(), 0); 122 EXPECT_EQ(queue.fullUploadSize(), 0);
121 EXPECT_EQ(queue.partialUploadSize(), 0); 123 EXPECT_EQ(queue.partialUploadSize(), 0);
122 124
123 { 125 {
124 DebugScopedSetImplThread implThread; 126 DebugScopedSetImplThread implThread(proxy());
125 DebugScopedSetMainThreadBlocked mainThreadBlocked; 127 DebugScopedSetMainThreadBlocked mainThreadBlocked(proxy());
126 m_layerTreeHost->contentsTextureManager()->clearAllMemory(resourceProvid er.get()); 128 m_layerTreeHost->contentsTextureManager()->clearAllMemory(resourceProvid er.get());
127 } 129 }
128 130
129 // Reupload after eviction 131 // Reupload after eviction
130 testLayer->setTexturePriorities(calculator); 132 testLayer->setTexturePriorities(calculator);
131 testLayer->update(queue, &occlusionTracker, stats); 133 testLayer->update(queue, &occlusionTracker, stats);
132 EXPECT_EQ(queue.fullUploadSize(), 1); 134 EXPECT_EQ(queue.fullUploadSize(), 1);
133 EXPECT_EQ(queue.partialUploadSize(), 0); 135 EXPECT_EQ(queue.partialUploadSize(), 0);
134 } 136 }
135 137
136 } // anonymous namespace 138 } // anonymous namespace
OLDNEW
« no previous file with comments | « cc/nine_patch_layer_impl_unittest.cc ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698