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

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

Issue 1976833002: Add some printf debugging to narrow CreateAndReleaseOutputSurface crash Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: printfdebugging: . Created 3 years, 7 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 | « no previous file | no next file » | 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 TEST_F(CompositorTestWithMockedTime, 311 TEST_F(CompositorTestWithMockedTime,
312 ReleaseWidgetWithOutputSurfaceNeverCreated) { 312 ReleaseWidgetWithOutputSurfaceNeverCreated) {
313 compositor()->SetVisible(false); 313 compositor()->SetVisible(false);
314 EXPECT_EQ(gfx::kNullAcceleratedWidget, 314 EXPECT_EQ(gfx::kNullAcceleratedWidget,
315 compositor()->ReleaseAcceleratedWidget()); 315 compositor()->ReleaseAcceleratedWidget());
316 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); 316 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
317 compositor()->SetVisible(true); 317 compositor()->SetVisible(true);
318 } 318 }
319 319
320 #if defined(OS_WIN) 320 TEST_F(CompositorTestWithMessageLoop, CreateAndReleaseOutputSurface) {
321 // TODO(crbug.com/608436): Flaky on windows trybots 321 LOG(ERROR) << "> Setup";
322 #define MAYBE_CreateAndReleaseOutputSurface \
323 DISABLED_CreateAndReleaseOutputSurface
324 #else
325 #define MAYBE_CreateAndReleaseOutputSurface CreateAndReleaseOutputSurface
326 #endif
327 TEST_F(CompositorTestWithMessageLoop, MAYBE_CreateAndReleaseOutputSurface) {
328 std::unique_ptr<Layer> root_layer(new Layer(ui::LAYER_SOLID_COLOR)); 322 std::unique_ptr<Layer> root_layer(new Layer(ui::LAYER_SOLID_COLOR));
329 root_layer->SetBounds(gfx::Rect(10, 10)); 323 root_layer->SetBounds(gfx::Rect(10, 10));
330 compositor()->SetRootLayer(root_layer.get()); 324 compositor()->SetRootLayer(root_layer.get());
331 compositor()->SetScaleAndSize(1.0f, gfx::Size(10, 10)); 325 compositor()->SetScaleAndSize(1.0f, gfx::Size(10, 10));
332 DCHECK(compositor()->IsVisible()); 326 ASSERT_TRUE(compositor()->IsVisible());
327 LOG(ERROR) << "< Setup";
328
329 LOG(ERROR) << "> ScheduleDraw 1";
333 compositor()->ScheduleDraw(); 330 compositor()->ScheduleDraw();
334 DrawWaiterForTest::WaitForCompositingEnded(compositor()); 331 DrawWaiterForTest::WaitForCompositingEnded(compositor());
332 LOG(ERROR) << "< ScheduleDraw 1";
333
334 // Go invisible and release the widget.
335 LOG(ERROR) << "> SetVisible(false)";
335 compositor()->SetVisible(false); 336 compositor()->SetVisible(false);
337 LOG(ERROR) << "< SetVisible(false)";
338 LOG(ERROR) << "> ReleaseAcceleratedWidget";
336 EXPECT_EQ(gfx::kNullAcceleratedWidget, 339 EXPECT_EQ(gfx::kNullAcceleratedWidget,
337 compositor()->ReleaseAcceleratedWidget()); 340 compositor()->ReleaseAcceleratedWidget());
341 LOG(ERROR) << "< ReleaseAcceleratedWidget";
342
343 // Set a new widget and become visible again.
344 LOG(ERROR) << "> SetAcceleratedWidget";
338 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); 345 compositor()->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
346 LOG(ERROR) << "< SetAcceleratedWidget";
347 LOG(ERROR) << "> SetVisible(true)";
339 compositor()->SetVisible(true); 348 compositor()->SetVisible(true);
349 LOG(ERROR) << "< SetVisible(true)";
350
351 LOG(ERROR) << "> ScheduleDraw 2";
340 compositor()->ScheduleDraw(); 352 compositor()->ScheduleDraw();
353 LOG(ERROR) << "< ScheduleDraw 2";
354 LOG(ERROR) << "> Wait for draw 2";
341 DrawWaiterForTest::WaitForCompositingEnded(compositor()); 355 DrawWaiterForTest::WaitForCompositingEnded(compositor());
356 LOG(ERROR) << "< Wait for draw 2";
357
342 compositor()->SetRootLayer(nullptr); 358 compositor()->SetRootLayer(nullptr);
343 } 359 }
344 360
345 } // namespace ui 361 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698