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

Side by Side Diff: cc/scheduler/begin_frame_source_unittest.cc

Issue 2930813002: Avoid DCHECK in ExternalBeginFrameSource::GetMissedBeginFrameArgs caused by out of order frame time (Closed)
Patch Set: Created 3 years, 6 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/scheduler/begin_frame_source.cc ('k') | 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/scheduler/begin_frame_source.h" 5 #include "cc/scheduler/begin_frame_source.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 // Providing same args through a different ExternalBeginFrameSource also does 567 // Providing same args through a different ExternalBeginFrameSource also does
568 // not notify observer. 568 // not notify observer.
569 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false); 569 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false);
570 EXPECT_CALL((*client_), OnNeedsBeginFrames(true)).Times(1); 570 EXPECT_CALL((*client_), OnNeedsBeginFrames(true)).Times(1);
571 ExternalBeginFrameSource source2(client_.get()); 571 ExternalBeginFrameSource source2(client_.get());
572 source2.AddObserver(obs_.get()); 572 source2.AddObserver(obs_.get());
573 source2.OnBeginFrame(args); 573 source2.OnBeginFrame(args);
574 } 574 }
575 575
576 // https://crbug.com/730218: Avoid DCHECK crash in
577 // ExternalBeginFrameSource::GetMissedBeginFrameArgs.
578 TEST_F(ExternalBeginFrameSourceTest, GetMissedBeginFrameArgs) {
579 BeginFrameArgs args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0,
580 2, 10000, 10100, 100);
581 source_->OnBeginFrame(args);
582
583 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false);
584 EXPECT_BEGIN_FRAME_USED_MISSED(*obs_, 0, 2, 10000, 10100, 100);
585 source_->AddObserver(obs_.get());
586 source_->RemoveObserver(obs_.get());
587
588 // Out of order frame_time. This might not be valid but still shouldn't
589 // cause a DCHECK in ExternalBeginFrameSource code.
590 args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 2, 9999, 10100,
591 101);
592 source_->OnBeginFrame(args);
593
594 EXPECT_CALL((*client_), OnNeedsBeginFrames(true)).Times(1);
595 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false);
596 EXPECT_CALL(*obs_, OnBeginFrame(CreateBeginFrameArgsForTesting(
sunnyps 2017/06/07 23:22:24 nit: EXPECT_CALL(*obs_, _) instead? We don't want
stanisc 2017/06/07 23:36:33 Done. I tried that initially but couldn't make it
597 BEGINFRAME_FROM_HERE, 0, 1, 9999, 10100, 101)))
598 .Times(0);
599 source_->AddObserver(obs_.get());
600 }
601
576 } // namespace 602 } // namespace
577 } // namespace cc 603 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/begin_frame_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698