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

Side by Side Diff: services/ui/surfaces/display_compositor_unittest.cc

Issue 2632273003: Move ReferencedSurfaceTracker into GpuCompositorFrameSink. (Closed)
Patch Set: Change ReferencedSurfaceTracker. 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/surfaces/display_compositor.h" 5 #include "services/ui/surfaces/display_compositor.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 private: 62 private:
63 void AddEvent(const std::string& text) { 63 void AddEvent(const std::string& text) {
64 if (!events_.empty()) 64 if (!events_.empty())
65 events_ += ";"; 65 events_ += ";";
66 events_ += text; 66 events_ += text;
67 } 67 }
68 68
69 // cc::mojom::DisplayCompositorClient: 69 // cc::mojom::DisplayCompositorClient:
70 void OnDisplayCompositorCreated(
71 const cc::SurfaceId& root_surface_id) override {
72 got_root_surface_id_ = true;
73 }
74
75 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override { 70 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {
76 EXPECT_TRUE(got_root_surface_id_);
77 AddEvent(base::StringPrintf("OnSurfaceCreated(%s)", 71 AddEvent(base::StringPrintf("OnSurfaceCreated(%s)",
78 SurfaceIdString(surface_info.id()).c_str())); 72 SurfaceIdString(surface_info.id()).c_str()));
79 } 73 }
80 74
81 mojo::Binding<cc::mojom::DisplayCompositorClient> binding_; 75 mojo::Binding<cc::mojom::DisplayCompositorClient> binding_;
82 std::string events_; 76 std::string events_;
83 bool got_root_surface_id_ = false;
84 77
85 DISALLOW_COPY_AND_ASSIGN(TestDisplayCompositorClient); 78 DISALLOW_COPY_AND_ASSIGN(TestDisplayCompositorClient);
86 }; 79 };
87 80
88 // Test SurfaceReferenceManager that records AddSurfaceReference() and 81 // Test SurfaceReferenceManager that records AddSurfaceReference() and
89 // RemoveSurfaceReference() events. 82 // RemoveSurfaceReference() events.
90 class TestSurfaceReferenceManager : public cc::SurfaceReferenceManager { 83 class TestSurfaceReferenceManager : public cc::SurfaceReferenceManager {
91 public: 84 public:
92 ~TestSurfaceReferenceManager() override {} 85 ~TestSurfaceReferenceManager() override {}
93 86
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 304
312 // The real reference should be added for 2:1:1 and temporary reference 305 // The real reference should be added for 2:1:1 and temporary reference
313 // should be removed. The temporary reference for 2:1:2 should remain. 306 // should be removed. The temporary reference for 2:1:2 should remain.
314 EXPECT_EQ("Add(1:1:1-2:1:1);Remove(0:0:0-2:1:1)", 307 EXPECT_EQ("Add(1:1:1-2:1:1);Remove(0:0:0-2:1:1)",
315 reference_manager_.events()); 308 reference_manager_.events());
316 EXPECT_EQ(1u, CountTempReferences()); 309 EXPECT_EQ(1u, CountTempReferences());
317 } 310 }
318 311
319 } // namespace test 312 } // namespace test
320 } // namespace ui 313 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698