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

Side by Side Diff: cc/layers/picture_layer_unittest.cc

Issue 348093004: Make cc output surface creation async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sievers review Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/layers/picture_layer_impl.h" 8 #include "cc/layers/picture_layer_impl.h"
9 #include "cc/resources/resource_update_queue.h" 9 #include "cc/resources/resource_update_queue.h"
10 #include "cc/test/fake_layer_tree_host.h" 10 #include "cc/test/fake_layer_tree_host.h"
(...skipping 18 matching lines...) Expand all
29 virtual bool FillsBoundsCompletely() const OVERRIDE { 29 virtual bool FillsBoundsCompletely() const OVERRIDE {
30 return false; 30 return false;
31 }; 31 };
32 }; 32 };
33 33
34 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { 34 TEST(PictureLayerTest, NoTilesIfEmptyBounds) {
35 MockContentLayerClient client; 35 MockContentLayerClient client;
36 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); 36 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
37 layer->SetBounds(gfx::Size(10, 10)); 37 layer->SetBounds(gfx::Size(10, 10));
38 38
39 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 39 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D);
40 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client);
40 host->SetRootLayer(layer); 41 host->SetRootLayer(layer);
41 layer->SetIsDrawable(true); 42 layer->SetIsDrawable(true);
42 layer->SavePaintProperties(); 43 layer->SavePaintProperties();
43 44
44 OcclusionTracker<Layer> occlusion(gfx::Rect(0, 0, 1000, 1000)); 45 OcclusionTracker<Layer> occlusion(gfx::Rect(0, 0, 1000, 1000));
45 scoped_ptr<ResourceUpdateQueue> queue(new ResourceUpdateQueue); 46 scoped_ptr<ResourceUpdateQueue> queue(new ResourceUpdateQueue);
46 layer->Update(queue.get(), &occlusion); 47 layer->Update(queue.get(), &occlusion);
47 48
48 layer->SetBounds(gfx::Size(0, 0)); 49 layer->SetBounds(gfx::Size(0, 0));
49 layer->SavePaintProperties(); 50 layer->SavePaintProperties();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 pile->SetUnsuitableForGpuRasterizationForTesting(); 83 pile->SetUnsuitableForGpuRasterizationForTesting();
83 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); 84 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization());
84 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); 85 EXPECT_FALSE(layer->IsSuitableForGpuRasterization());
85 } 86 }
86 87
87 TEST(PictureLayerTest, RecordingModes) { 88 TEST(PictureLayerTest, RecordingModes) {
88 MockContentLayerClient client; 89 MockContentLayerClient client;
89 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); 90 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
90 91
91 LayerTreeSettings settings; 92 LayerTreeSettings settings;
92 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(settings); 93 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D);
94 scoped_ptr<FakeLayerTreeHost> host =
95 FakeLayerTreeHost::Create(&host_client, settings);
93 host->SetRootLayer(layer); 96 host->SetRootLayer(layer);
94 EXPECT_EQ(Picture::RECORD_NORMALLY, layer->RecordingMode()); 97 EXPECT_EQ(Picture::RECORD_NORMALLY, layer->RecordingMode());
95 98
96 settings.recording_mode = LayerTreeSettings::RecordWithSkRecord; 99 settings.recording_mode = LayerTreeSettings::RecordWithSkRecord;
97 host = FakeLayerTreeHost::Create(settings); 100 host = FakeLayerTreeHost::Create(&host_client, settings);
98 host->SetRootLayer(layer); 101 host->SetRootLayer(layer);
99 EXPECT_EQ(Picture::RECORD_WITH_SKRECORD, layer->RecordingMode()); 102 EXPECT_EQ(Picture::RECORD_WITH_SKRECORD, layer->RecordingMode());
100 } 103 }
101 104
102 } // namespace 105 } // namespace
103 } // namespace cc 106 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698