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

Side by Side Diff: ui/compositor/compositor_unittest.cc

Issue 2815073002: Revert of Remove CompositorObserver::OnCompositingEnded() (Closed)
Patch Set: Fix CompositorObservers test Created 3 years, 8 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 | « ui/compositor/compositor_observer.h ('k') | ui/compositor/layer_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/test_mock_time_task_runner.h" 9 #include "base/test/test_mock_time_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 88 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
89 }; 89 };
90 90
91 class CompositorObserverForLocks : public CompositorObserver { 91 class CompositorObserverForLocks : public CompositorObserver {
92 public: 92 public:
93 CompositorObserverForLocks() = default; 93 CompositorObserverForLocks() = default;
94 94
95 void OnCompositingDidCommit(Compositor* compositor) override {} 95 void OnCompositingDidCommit(Compositor* compositor) override {}
96 void OnCompositingStarted(Compositor* compositor, 96 void OnCompositingStarted(Compositor* compositor,
97 base::TimeTicks start_time) override {} 97 base::TimeTicks start_time) override {}
98 void OnCompositingEnded(Compositor* compositor) override {}
98 void OnCompositingLockStateChanged(Compositor* compositor) override { 99 void OnCompositingLockStateChanged(Compositor* compositor) override {
99 changed_ = true; 100 changed_ = true;
100 locked_ = compositor->IsLocked(); 101 locked_ = compositor->IsLocked();
101 } 102 }
102 void OnCompositingShuttingDown(Compositor* compositor) override {} 103 void OnCompositingShuttingDown(Compositor* compositor) override {}
103 104
104 bool changed() const { return changed_; } 105 bool changed() const { return changed_; }
105 bool locked() const { return locked_; } 106 bool locked() const { return locked_; }
106 107
107 void Reset() { changed_ = false; } 108 void Reset() { changed_ = false; }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 #else 324 #else
324 #define MAYBE_CreateAndReleaseOutputSurface CreateAndReleaseOutputSurface 325 #define MAYBE_CreateAndReleaseOutputSurface CreateAndReleaseOutputSurface
325 #endif 326 #endif
326 TEST_F(CompositorTestWithMessageLoop, MAYBE_CreateAndReleaseOutputSurface) { 327 TEST_F(CompositorTestWithMessageLoop, MAYBE_CreateAndReleaseOutputSurface) {
327 std::unique_ptr<Layer> root_layer(new Layer(ui::LAYER_SOLID_COLOR)); 328 std::unique_ptr<Layer> root_layer(new Layer(ui::LAYER_SOLID_COLOR));
328 root_layer->SetBounds(gfx::Rect(10, 10)); 329 root_layer->SetBounds(gfx::Rect(10, 10));
329 compositor()->SetRootLayer(root_layer.get()); 330 compositor()->SetRootLayer(root_layer.get());
330 compositor()->SetScaleAndSize(1.0f, gfx::Size(10, 10)); 331 compositor()->SetScaleAndSize(1.0f, gfx::Size(10, 10));
331 DCHECK(compositor()->IsVisible()); 332 DCHECK(compositor()->IsVisible());
332 compositor()->ScheduleDraw(); 333 compositor()->ScheduleDraw();
333 DrawWaiterForTest::WaitForCompositingStarted(compositor()); 334 DrawWaiterForTest::WaitForCompositingEnded(compositor());
334 compositor()->SetVisible(false); 335 compositor()->SetVisible(false);
335 EXPECT_EQ(gfx::kNullAcceleratedWidget, 336 EXPECT_EQ(gfx::kNullAcceleratedWidget,
336 compositor()->ReleaseAcceleratedWidget()); 337 compositor()->ReleaseAcceleratedWidget());
337 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); 338 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
338 compositor()->SetVisible(true); 339 compositor()->SetVisible(true);
339 compositor()->ScheduleDraw(); 340 compositor()->ScheduleDraw();
340 DrawWaiterForTest::WaitForCompositingStarted(compositor()); 341 DrawWaiterForTest::WaitForCompositingEnded(compositor());
341 compositor()->SetRootLayer(nullptr); 342 compositor()->SetRootLayer(nullptr);
342 } 343 }
343 344
344 } // namespace ui 345 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor_observer.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698