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

Side by Side Diff: cc/nine_patch_layer_unittest.cc

Issue 11450019: Finish the rename from cc::GraphicsContext to cc::OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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 | Annotate | Revision Log
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 "cc/nine_patch_layer.h" 5 #include "cc/nine_patch_layer.h"
6 6
7 #include "cc/layer_tree_host.h" 7 #include "cc/layer_tree_host.h"
8 #include "cc/occlusion_tracker.h" 8 #include "cc/occlusion_tracker.h"
9 #include "cc/overdraw_metrics.h" 9 #include "cc/overdraw_metrics.h"
10 #include "cc/rendering_stats.h" 10 #include "cc/rendering_stats.h"
11 #include "cc/resource_provider.h" 11 #include "cc/resource_provider.h"
12 #include "cc/single_thread_proxy.h" 12 #include "cc/single_thread_proxy.h"
13 #include "cc/resource_update_queue.h" 13 #include "cc/resource_update_queue.h"
14 #include "cc/texture_uploader.h" 14 #include "cc/texture_uploader.h"
15 #include "cc/test/fake_graphics_context.h"
16 #include "cc/test/fake_layer_tree_host_client.h" 15 #include "cc/test/fake_layer_tree_host_client.h"
16 #include "cc/test/fake_output_surface.h"
17 #include "cc/test/geometry_test_utils.h" 17 #include "cc/test/geometry_test_utils.h"
18 #include "cc/test/layer_tree_test_common.h" 18 #include "cc/test/layer_tree_test_common.h"
19 #include "SkBitmap.h" 19 #include "SkBitmap.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 using ::testing::Mock; 23 using ::testing::Mock;
24 using ::testing::_; 24 using ::testing::_;
25 using ::testing::AtLeast; 25 using ::testing::AtLeast;
26 using ::testing::AnyNumber; 26 using ::testing::AnyNumber;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 testLayer->update(queue, &occlusionTracker, stats); 96 testLayer->update(queue, &occlusionTracker, stats);
97 EXPECT_EQ(queue.fullUploadSize(), 1); 97 EXPECT_EQ(queue.fullUploadSize(), 1);
98 EXPECT_EQ(queue.partialUploadSize(), 0); 98 EXPECT_EQ(queue.partialUploadSize(), 0);
99 ResourceUpdate params = queue.takeFirstFullUpload(); 99 ResourceUpdate params = queue.takeFirstFullUpload();
100 EXPECT_TRUE(params.texture != NULL); 100 EXPECT_TRUE(params.texture != NULL);
101 101
102 // Upload the texture. 102 // Upload the texture.
103 m_layerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(1024 * 102 4); 103 m_layerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(1024 * 102 4);
104 m_layerTreeHost->contentsTextureManager()->prioritizeTextures(); 104 m_layerTreeHost->contentsTextureManager()->prioritizeTextures();
105 105
106 scoped_ptr<GraphicsContext> context; 106 scoped_ptr<OutputSurface> outputSurface;
107 scoped_ptr<ResourceProvider> resourceProvider; 107 scoped_ptr<ResourceProvider> resourceProvider;
108 { 108 {
109 DebugScopedSetImplThread implThread(proxy()); 109 DebugScopedSetImplThread implThread(proxy());
110 DebugScopedSetMainThreadBlocked mainThreadBlocked(proxy()); 110 DebugScopedSetMainThreadBlocked mainThreadBlocked(proxy());
111 context = WebKit::createFakeGraphicsContext(); 111 outputSurface = createFakeOutputSurface();
112 resourceProvider = ResourceProvider::create(context.get()); 112 resourceProvider = ResourceProvider::create(outputSurface.get());
113 params.texture->acquireBackingTexture(resourceProvider.get()); 113 params.texture->acquireBackingTexture(resourceProvider.get());
114 ASSERT_TRUE(params.texture->haveBackingTexture()); 114 ASSERT_TRUE(params.texture->haveBackingTexture());
115 } 115 }
116 116
117 // Nothing changed, so no repeated upload. 117 // Nothing changed, so no repeated upload.
118 testLayer->setTexturePriorities(calculator); 118 testLayer->setTexturePriorities(calculator);
119 testLayer->update(queue, &occlusionTracker, stats); 119 testLayer->update(queue, &occlusionTracker, stats);
120 EXPECT_EQ(queue.fullUploadSize(), 0); 120 EXPECT_EQ(queue.fullUploadSize(), 0);
121 EXPECT_EQ(queue.partialUploadSize(), 0); 121 EXPECT_EQ(queue.partialUploadSize(), 0);
122 122
(...skipping 17 matching lines...) Expand all
140 testLayer->update(queue2, &occlusionTracker, stats); 140 testLayer->update(queue2, &occlusionTracker, stats);
141 EXPECT_EQ(queue2.fullUploadSize(), 1); 141 EXPECT_EQ(queue2.fullUploadSize(), 1);
142 EXPECT_EQ(queue2.partialUploadSize(), 0); 142 EXPECT_EQ(queue2.partialUploadSize(), 0);
143 params = queue2.takeFirstFullUpload(); 143 params = queue2.takeFirstFullUpload();
144 EXPECT_TRUE(params.texture != NULL); 144 EXPECT_TRUE(params.texture != NULL);
145 EXPECT_EQ(params.texture->resourceManager(), m_layerTreeHost->contentsTextur eManager()); 145 EXPECT_EQ(params.texture->resourceManager(), m_layerTreeHost->contentsTextur eManager());
146 } 146 }
147 147
148 } // namespace 148 } // namespace
149 } // namespace cc 149 } // namespace cc
OLDNEW
« cc/layer_tree_host.cc ('K') | « cc/nine_patch_layer_impl.cc ('k') | cc/output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698