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

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

Issue 2724383002: TestCompositorFrameSink should use CompositorFrameSinkSupport (Closed)
Patch Set: bring back PostTask Created 3 years, 9 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 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/layers/texture_layer.h" 5 #include "cc/layers/texture_layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 1169
1170 TextureMailbox MakeMailbox(char name) { 1170 TextureMailbox MakeMailbox(char name) {
1171 return TextureMailbox(MailboxFromChar(name), 1171 return TextureMailbox(MailboxFromChar(name),
1172 SyncTokenFromUInt(static_cast<uint32_t>(name)), 1172 SyncTokenFromUInt(static_cast<uint32_t>(name)),
1173 GL_TEXTURE_2D); 1173 GL_TEXTURE_2D);
1174 } 1174 }
1175 1175
1176 void MailboxReleased(const gpu::SyncToken& sync_token, bool lost_resource) { 1176 void MailboxReleased(const gpu::SyncToken& sync_token, bool lost_resource) {
1177 EXPECT_TRUE(sync_token.HasData()); 1177 EXPECT_TRUE(sync_token.HasData());
1178 ++mailbox_returned_; 1178 ++mailbox_returned_;
1179 switch (mailbox_returned_) {
1180 case 1:
1181 break;
1182 case 2:
1183 EXPECT_EQ(commit_count_, 5);
1184 EndTest();
1185 break;
1186 default:
1187 NOTREACHED();
1188 }
1179 } 1189 }
1180 1190
1181 void SetupTree() override { 1191 void SetupTree() override {
1182 scoped_refptr<Layer> root = Layer::Create(); 1192 scoped_refptr<Layer> root = Layer::Create();
1183 root->SetBounds(gfx::Size(10, 10)); 1193 root->SetBounds(gfx::Size(10, 10));
1184 root->SetIsDrawable(true); 1194 root->SetIsDrawable(true);
1185 1195
1186 solid_layer_ = SolidColorLayer::Create(); 1196 solid_layer_ = SolidColorLayer::Create();
1187 solid_layer_->SetBounds(gfx::Size(10, 10)); 1197 solid_layer_->SetBounds(gfx::Size(10, 10));
1188 solid_layer_->SetIsDrawable(true); 1198 solid_layer_->SetIsDrawable(true);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 parent_layer_->SetOpacity(0.9f); 1243 parent_layer_->SetOpacity(0.9f);
1234 break; 1244 break;
1235 case 4: 1245 case 4:
1236 // Layer should have been updated. 1246 // Layer should have been updated.
1237 EXPECT_EQ(2, prepare_called_); 1247 EXPECT_EQ(2, prepare_called_);
1238 // So the old mailbox should have been returned already. 1248 // So the old mailbox should have been returned already.
1239 EXPECT_EQ(1, mailbox_returned_); 1249 EXPECT_EQ(1, mailbox_returned_);
1240 texture_layer_->ClearClient(); 1250 texture_layer_->ClearClient();
1241 break; 1251 break;
1242 case 5: 1252 case 5:
1243 EXPECT_EQ(2, mailbox_returned_);
1244 EndTest();
1245 break; 1253 break;
1246 default: 1254 default:
1247 NOTREACHED(); 1255 NOTREACHED();
1248 break; 1256 break;
1249 } 1257 }
1250 } 1258 }
1251 1259
1252 void AfterTest() override {} 1260 void AfterTest() override {}
1253 1261
1254 private: 1262 private:
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 base::ThreadChecker main_thread_; 1484 base::ThreadChecker main_thread_;
1477 int callback_count_; 1485 int callback_count_;
1478 scoped_refptr<Layer> root_; 1486 scoped_refptr<Layer> root_;
1479 scoped_refptr<TextureLayer> layer_; 1487 scoped_refptr<TextureLayer> layer_;
1480 }; 1488 };
1481 1489
1482 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); 1490 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted);
1483 1491
1484 } // namespace 1492 } // namespace
1485 } // namespace cc 1493 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/test/test_compositor_frame_sink.h » ('j') | cc/test/test_compositor_frame_sink.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698