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

Side by Side Diff: cc/surfaces/surface_factory_unittest.cc

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 11 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
« no previous file with comments | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surface_info.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surfaces/surface_factory.h" 5 #include "cc/surfaces/surface_factory.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "cc/output/compositor_frame.h" 15 #include "cc/output/compositor_frame.h"
16 #include "cc/output/copy_output_request.h" 16 #include "cc/output/copy_output_request.h"
17 #include "cc/output/copy_output_result.h" 17 #include "cc/output/copy_output_result.h"
18 #include "cc/resources/resource_provider.h" 18 #include "cc/resources/resource_provider.h"
19 #include "cc/surfaces/surface.h" 19 #include "cc/surfaces/surface.h"
20 #include "cc/surfaces/surface_factory_client.h" 20 #include "cc/surfaces/surface_factory_client.h"
21 #include "cc/surfaces/surface_info.h"
21 #include "cc/surfaces/surface_manager.h" 22 #include "cc/surfaces/surface_manager.h"
22 #include "cc/test/scheduler_test_common.h" 23 #include "cc/test/scheduler_test_common.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
25 26
26 namespace cc { 27 namespace cc {
27 namespace { 28 namespace {
28 29
29 static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); 30 static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
30 static constexpr FrameSinkId kAnotherArbitraryFrameSinkId(2, 2); 31 static constexpr FrameSinkId kAnotherArbitraryFrameSinkId(2, 2);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 frame_sync_token_(GenTestSyncToken(4)), 77 frame_sync_token_(GenTestSyncToken(4)),
77 consumer_sync_token_(GenTestSyncToken(5)) { 78 consumer_sync_token_(GenTestSyncToken(5)) {
78 manager_.AddObserver(this); 79 manager_.AddObserver(this);
79 } 80 }
80 81
81 const SurfaceId& last_created_surface_id() const { 82 const SurfaceId& last_created_surface_id() const {
82 return last_created_surface_id_; 83 return last_created_surface_id_;
83 } 84 }
84 85
85 // SurfaceObserver implementation. 86 // SurfaceObserver implementation.
86 void OnSurfaceCreated(const SurfaceId& surface_id, 87 void OnSurfaceCreated(const SurfaceInfo& surface_info) override {
87 const gfx::Size& frame, 88 EXPECT_EQ(kArbitraryFrameSinkId, surface_info.id().frame_sink_id());
88 float device_scale_factor) override { 89 last_created_surface_id_ = surface_info.id();
89 EXPECT_EQ(kArbitraryFrameSinkId, surface_id.frame_sink_id());
90 last_created_surface_id_ = surface_id;
91 } 90 }
92 91
93 void OnSurfaceDamaged(const SurfaceId& id, bool* changed) override { 92 void OnSurfaceDamaged(const SurfaceId& id, bool* changed) override {
94 *changed = true; 93 *changed = true;
95 } 94 }
96 95
97 ~SurfaceFactoryTest() override { 96 ~SurfaceFactoryTest() override {
98 manager_.RemoveObserver(this); 97 manager_.RemoveObserver(this);
99 factory_->EvictSurface(); 98 factory_->EvictSurface();
100 } 99 }
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 666
668 factory_->EvictSurface(); 667 factory_->EvictSurface();
669 local_frame_id_ = LocalFrameId(); 668 local_frame_id_ = LocalFrameId();
670 EXPECT_TRUE(called1); 669 EXPECT_TRUE(called1);
671 EXPECT_TRUE(called2); 670 EXPECT_TRUE(called2);
672 EXPECT_TRUE(called3); 671 EXPECT_TRUE(called3);
673 } 672 }
674 673
675 } // namespace 674 } // namespace
676 } // namespace cc 675 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surface_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698