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

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

Issue 1132753008: Replaced TestNowSource with SimpleTestTickClock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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/cc_tests.gyp ('k') | cc/scheduler/scheduler_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 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 <deque> 5 #include <deque>
6 #include <string> 6 #include <string>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 scoped_refptr<base::trace_event::TracedValue> state = 308 scoped_refptr<base::trace_event::TracedValue> state =
309 new base::trace_event::TracedValue(); 309 new base::trace_event::TracedValue();
310 source.AsValueInto(state.get()); 310 source.AsValueInto(state.get());
311 } 311 }
312 312
313 // BackToBackBeginFrameSource testing ----------------------------------------- 313 // BackToBackBeginFrameSource testing -----------------------------------------
314 class TestBackToBackBeginFrameSource : public BackToBackBeginFrameSource { 314 class TestBackToBackBeginFrameSource : public BackToBackBeginFrameSource {
315 public: 315 public:
316 static scoped_ptr<TestBackToBackBeginFrameSource> Create( 316 static scoped_ptr<TestBackToBackBeginFrameSource> Create(
317 scoped_refptr<TestNowSource> now_src, 317 base::SimpleTestTickClock* now_src,
318 base::SingleThreadTaskRunner* task_runner) { 318 base::SingleThreadTaskRunner* task_runner) {
319 return make_scoped_ptr( 319 return make_scoped_ptr(
320 new TestBackToBackBeginFrameSource(now_src, task_runner)); 320 new TestBackToBackBeginFrameSource(now_src, task_runner));
321 } 321 }
322 322
323 protected: 323 protected:
324 TestBackToBackBeginFrameSource(scoped_refptr<TestNowSource> now_src, 324 TestBackToBackBeginFrameSource(base::SimpleTestTickClock* now_src,
325 base::SingleThreadTaskRunner* task_runner) 325 base::SingleThreadTaskRunner* task_runner)
326 : BackToBackBeginFrameSource(task_runner), now_src_(now_src) {} 326 : BackToBackBeginFrameSource(task_runner), now_src_(now_src) {}
327 327
328 base::TimeTicks Now() override { return now_src_->Now(); } 328 base::TimeTicks Now() override { return now_src_->NowTicks(); }
329 329
330 scoped_refptr<TestNowSource> now_src_; 330 // Not owned.
331 base::SimpleTestTickClock* now_src_;
331 }; 332 };
332 333
333 class BackToBackBeginFrameSourceTest : public ::testing::Test { 334 class BackToBackBeginFrameSourceTest : public ::testing::Test {
334 public: 335 public:
335 static const int64_t kDeadline; 336 static const int64_t kDeadline;
336 static const int64_t kInterval; 337 static const int64_t kInterval;
337 338
338 scoped_refptr<TestNowSource> now_src_; 339 scoped_ptr<base::SimpleTestTickClock> now_src_;
339 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; 340 scoped_refptr<OrderedSimpleTaskRunner> task_runner_;
340 scoped_ptr<TestBackToBackBeginFrameSource> source_; 341 scoped_ptr<TestBackToBackBeginFrameSource> source_;
341 scoped_ptr<MockBeginFrameObserver> obs_; 342 scoped_ptr<MockBeginFrameObserver> obs_;
342 343
343 void SetUp() override { 344 void SetUp() override {
344 now_src_ = TestNowSource::Create(1000); 345 now_src_.reset(new base::SimpleTestTickClock());
346 now_src_->Advance(base::TimeDelta::FromMicroseconds(1000));
345 task_runner_ = 347 task_runner_ =
346 make_scoped_refptr(new OrderedSimpleTaskRunner(now_src_, false)); 348 make_scoped_refptr(new OrderedSimpleTaskRunner(now_src_.get(), false));
347 task_runner_->SetRunTaskLimit(1); 349 task_runner_->SetRunTaskLimit(1);
348 source_ = 350 source_ = TestBackToBackBeginFrameSource::Create(now_src_.get(),
349 TestBackToBackBeginFrameSource::Create(now_src_, task_runner_.get()); 351 task_runner_.get());
350 obs_ = make_scoped_ptr(new ::testing::StrictMock<MockBeginFrameObserver>()); 352 obs_ = make_scoped_ptr(new ::testing::StrictMock<MockBeginFrameObserver>());
351 source_->AddObserver(obs_.get()); 353 source_->AddObserver(obs_.get());
352 } 354 }
353 355
354 void TearDown() override { obs_.reset(); } 356 void TearDown() override { obs_.reset(); }
355 }; 357 };
356 358
357 const int64_t BackToBackBeginFrameSourceTest::kDeadline = 359 const int64_t BackToBackBeginFrameSourceTest::kDeadline =
358 BeginFrameArgs::DefaultInterval().ToInternalValue(); 360 BeginFrameArgs::DefaultInterval().ToInternalValue();
359 361
360 const int64_t BackToBackBeginFrameSourceTest::kInterval = 362 const int64_t BackToBackBeginFrameSourceTest::kInterval =
361 BeginFrameArgs::DefaultInterval().ToInternalValue(); 363 BeginFrameArgs::DefaultInterval().ToInternalValue();
362 364
363 TEST_F(BackToBackBeginFrameSourceTest, SetNeedsBeginFramesSendsBeginFrame) { 365 TEST_F(BackToBackBeginFrameSourceTest, SetNeedsBeginFramesSendsBeginFrame) {
364 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 366 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
365 source_->SetNeedsBeginFrames(true); 367 source_->SetNeedsBeginFrames(true);
366 EXPECT_TRUE(task_runner_->HasPendingTasks()); 368 EXPECT_TRUE(task_runner_->HasPendingTasks());
367 task_runner_->RunUntilIdle(); 369 task_runner_->RunUntilIdle();
368 370
369 EXPECT_BEGIN_FRAME_USED(*obs_, 1100, 1100 + kDeadline, kInterval); 371 EXPECT_BEGIN_FRAME_USED(*obs_, 1100, 1100 + kDeadline, kInterval);
370 now_src_->AdvanceNowMicroseconds(100); 372 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
371 source_->DidFinishFrame(0); 373 source_->DidFinishFrame(0);
372 task_runner_->RunUntilIdle(); 374 task_runner_->RunUntilIdle();
373 } 375 }
374 376
375 TEST_F(BackToBackBeginFrameSourceTest, 377 TEST_F(BackToBackBeginFrameSourceTest,
376 DidFinishFrameThenSetNeedsBeginFramesProducesNoFrame) { 378 DidFinishFrameThenSetNeedsBeginFramesProducesNoFrame) {
377 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 379 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
378 source_->SetNeedsBeginFrames(true); 380 source_->SetNeedsBeginFrames(true);
379 task_runner_->RunUntilIdle(); 381 task_runner_->RunUntilIdle();
380 382
381 source_->SetNeedsBeginFrames(false); 383 source_->SetNeedsBeginFrames(false);
382 source_->DidFinishFrame(0); 384 source_->DidFinishFrame(0);
383 385
384 EXPECT_FALSE(task_runner_->HasPendingTasks()); 386 EXPECT_FALSE(task_runner_->HasPendingTasks());
385 } 387 }
386 388
387 TEST_F(BackToBackBeginFrameSourceTest, 389 TEST_F(BackToBackBeginFrameSourceTest,
388 SetNeedsBeginFramesThenDidFinishFrameProducesNoFrame) { 390 SetNeedsBeginFramesThenDidFinishFrameProducesNoFrame) {
389 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 391 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
390 source_->SetNeedsBeginFrames(true); 392 source_->SetNeedsBeginFrames(true);
391 task_runner_->RunUntilIdle(); 393 task_runner_->RunUntilIdle();
392 394
393 now_src_->AdvanceNowMicroseconds(100); 395 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
394 source_->DidFinishFrame(0); 396 source_->DidFinishFrame(0);
395 source_->SetNeedsBeginFrames(false); 397 source_->SetNeedsBeginFrames(false);
396 398
397 EXPECT_TRUE(task_runner_->HasPendingTasks()); 399 EXPECT_TRUE(task_runner_->HasPendingTasks());
398 task_runner_->RunUntilIdle(); 400 task_runner_->RunUntilIdle();
399 } 401 }
400 402
401 TEST_F(BackToBackBeginFrameSourceTest, 403 TEST_F(BackToBackBeginFrameSourceTest,
402 DidFinishFrameThenTogglingSetNeedsBeginFramesProducesCorrectFrame) { 404 DidFinishFrameThenTogglingSetNeedsBeginFramesProducesCorrectFrame) {
403 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 405 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
404 source_->SetNeedsBeginFrames(true); 406 source_->SetNeedsBeginFrames(true);
405 task_runner_->RunUntilIdle(); 407 task_runner_->RunUntilIdle();
406 408
407 now_src_->AdvanceNowMicroseconds(100); 409 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
408 410
409 source_->SetNeedsBeginFrames(false); 411 source_->SetNeedsBeginFrames(false);
410 now_src_->AdvanceNowMicroseconds(10); 412 now_src_->Advance(base::TimeDelta::FromMicroseconds(10));
411 source_->DidFinishFrame(0); 413 source_->DidFinishFrame(0);
412 now_src_->AdvanceNowMicroseconds(10); 414 now_src_->Advance(base::TimeDelta::FromMicroseconds(10));
413 source_->SetNeedsBeginFrames(false); 415 source_->SetNeedsBeginFrames(false);
414 now_src_->AdvanceNowMicroseconds(10); 416 now_src_->Advance(base::TimeDelta::FromMicroseconds(10));
415 source_->SetNeedsBeginFrames(true); 417 source_->SetNeedsBeginFrames(true);
416 418
417 EXPECT_BEGIN_FRAME_USED(*obs_, 1130, 1130 + kDeadline, kInterval); 419 EXPECT_BEGIN_FRAME_USED(*obs_, 1130, 1130 + kDeadline, kInterval);
418 EXPECT_TRUE(task_runner_->HasPendingTasks()); 420 EXPECT_TRUE(task_runner_->HasPendingTasks());
419 task_runner_->RunUntilIdle(); 421 task_runner_->RunUntilIdle();
420 } 422 }
421 423
422 TEST_F(BackToBackBeginFrameSourceTest, 424 TEST_F(BackToBackBeginFrameSourceTest,
423 TogglingSetNeedsBeginFramesThenDidFinishFrameProducesCorrectFrame) { 425 TogglingSetNeedsBeginFramesThenDidFinishFrameProducesCorrectFrame) {
424 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 426 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
425 source_->SetNeedsBeginFrames(true); 427 source_->SetNeedsBeginFrames(true);
426 task_runner_->RunUntilIdle(); 428 task_runner_->RunUntilIdle();
427 429
428 now_src_->AdvanceNowMicroseconds(100); 430 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
429 source_->DidFinishFrame(0); 431 source_->DidFinishFrame(0);
430 now_src_->AdvanceNowMicroseconds(10); 432 now_src_->Advance(base::TimeDelta::FromMicroseconds(10));
431 source_->SetNeedsBeginFrames(false); 433 source_->SetNeedsBeginFrames(false);
432 now_src_->AdvanceNowMicroseconds(10); 434 now_src_->Advance(base::TimeDelta::FromMicroseconds(10));
433 source_->SetNeedsBeginFrames(true); 435 source_->SetNeedsBeginFrames(true);
434 now_src_->AdvanceNowMicroseconds(10); 436 now_src_->Advance(base::TimeDelta::FromMicroseconds(10));
435 437
436 EXPECT_BEGIN_FRAME_USED(*obs_, 1130, 1130 + kDeadline, kInterval); 438 EXPECT_BEGIN_FRAME_USED(*obs_, 1130, 1130 + kDeadline, kInterval);
437 EXPECT_TRUE(task_runner_->HasPendingTasks()); 439 EXPECT_TRUE(task_runner_->HasPendingTasks());
438 task_runner_->RunUntilIdle(); 440 task_runner_->RunUntilIdle();
439 } 441 }
440 442
441 TEST_F(BackToBackBeginFrameSourceTest, DidFinishFrameNeedsBeginFrameFalse) { 443 TEST_F(BackToBackBeginFrameSourceTest, DidFinishFrameNeedsBeginFrameFalse) {
442 source_->SetNeedsBeginFrames(false); 444 source_->SetNeedsBeginFrames(false);
443 source_->DidFinishFrame(0); 445 source_->DidFinishFrame(0);
444 EXPECT_FALSE(task_runner_->RunPendingTasks()); 446 EXPECT_FALSE(task_runner_->RunPendingTasks());
445 } 447 }
446 448
447 TEST_F(BackToBackBeginFrameSourceTest, DidFinishFrameRemainingFrames) { 449 TEST_F(BackToBackBeginFrameSourceTest, DidFinishFrameRemainingFrames) {
448 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 450 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
449 source_->SetNeedsBeginFrames(true); 451 source_->SetNeedsBeginFrames(true);
450 task_runner_->RunUntilIdle(); 452 task_runner_->RunUntilIdle();
451 453
452 now_src_->AdvanceNowMicroseconds(100); 454 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
453 455
454 source_->DidFinishFrame(3); 456 source_->DidFinishFrame(3);
455 EXPECT_FALSE(task_runner_->HasPendingTasks()); 457 EXPECT_FALSE(task_runner_->HasPendingTasks());
456 source_->DidFinishFrame(2); 458 source_->DidFinishFrame(2);
457 EXPECT_FALSE(task_runner_->HasPendingTasks()); 459 EXPECT_FALSE(task_runner_->HasPendingTasks());
458 source_->DidFinishFrame(1); 460 source_->DidFinishFrame(1);
459 EXPECT_FALSE(task_runner_->HasPendingTasks()); 461 EXPECT_FALSE(task_runner_->HasPendingTasks());
460 462
461 EXPECT_BEGIN_FRAME_USED(*obs_, 1100, 1100 + kDeadline, kInterval); 463 EXPECT_BEGIN_FRAME_USED(*obs_, 1100, 1100 + kDeadline, kInterval);
462 source_->DidFinishFrame(0); 464 source_->DidFinishFrame(0);
463 EXPECT_EQ(base::TimeDelta(), task_runner_->DelayToNextTaskTime()); 465 EXPECT_EQ(base::TimeDelta(), task_runner_->DelayToNextTaskTime());
464 task_runner_->RunUntilIdle(); 466 task_runner_->RunUntilIdle();
465 } 467 }
466 468
467 TEST_F(BackToBackBeginFrameSourceTest, DidFinishFrameMultipleCallsIdempotent) { 469 TEST_F(BackToBackBeginFrameSourceTest, DidFinishFrameMultipleCallsIdempotent) {
468 source_->SetNeedsBeginFrames(true); 470 source_->SetNeedsBeginFrames(true);
469 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 471 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
470 task_runner_->RunUntilIdle(); 472 task_runner_->RunUntilIdle();
471 473
472 now_src_->AdvanceNowMicroseconds(100); 474 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
473 source_->DidFinishFrame(0); 475 source_->DidFinishFrame(0);
474 source_->DidFinishFrame(0); 476 source_->DidFinishFrame(0);
475 source_->DidFinishFrame(0); 477 source_->DidFinishFrame(0);
476 EXPECT_BEGIN_FRAME_USED(*obs_, 1100, 1100 + kDeadline, kInterval); 478 EXPECT_BEGIN_FRAME_USED(*obs_, 1100, 1100 + kDeadline, kInterval);
477 task_runner_->RunUntilIdle(); 479 task_runner_->RunUntilIdle();
478 480
479 now_src_->AdvanceNowMicroseconds(100); 481 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
480 source_->DidFinishFrame(0); 482 source_->DidFinishFrame(0);
481 source_->DidFinishFrame(0); 483 source_->DidFinishFrame(0);
482 source_->DidFinishFrame(0); 484 source_->DidFinishFrame(0);
483 EXPECT_BEGIN_FRAME_USED(*obs_, 1200, 1200 + kDeadline, kInterval); 485 EXPECT_BEGIN_FRAME_USED(*obs_, 1200, 1200 + kDeadline, kInterval);
484 task_runner_->RunUntilIdle(); 486 task_runner_->RunUntilIdle();
485 } 487 }
486 488
487 TEST_F(BackToBackBeginFrameSourceTest, DelayInPostedTaskProducesCorrectFrame) { 489 TEST_F(BackToBackBeginFrameSourceTest, DelayInPostedTaskProducesCorrectFrame) {
488 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 490 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
489 source_->SetNeedsBeginFrames(true); 491 source_->SetNeedsBeginFrames(true);
490 task_runner_->RunUntilIdle(); 492 task_runner_->RunUntilIdle();
491 493
492 now_src_->AdvanceNowMicroseconds(100); 494 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
493 source_->DidFinishFrame(0); 495 source_->DidFinishFrame(0);
494 now_src_->AdvanceNowMicroseconds(50); 496 now_src_->Advance(base::TimeDelta::FromMicroseconds(50));
495 EXPECT_BEGIN_FRAME_USED(*obs_, 1150, 1150 + kDeadline, kInterval); 497 EXPECT_BEGIN_FRAME_USED(*obs_, 1150, 1150 + kDeadline, kInterval);
496 498
497 EXPECT_TRUE(task_runner_->HasPendingTasks()); 499 EXPECT_TRUE(task_runner_->HasPendingTasks());
498 task_runner_->RunUntilIdle(); 500 task_runner_->RunUntilIdle();
499 } 501 }
500 502
501 // SyntheticBeginFrameSource testing ------------------------------------------ 503 // SyntheticBeginFrameSource testing ------------------------------------------
502 class SyntheticBeginFrameSourceTest : public ::testing::Test { 504 class SyntheticBeginFrameSourceTest : public ::testing::Test {
503 public: 505 public:
504 scoped_refptr<TestNowSource> now_src_; 506 scoped_ptr<base::SimpleTestTickClock> now_src_;
505 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; 507 scoped_refptr<OrderedSimpleTaskRunner> task_runner_;
506 scoped_ptr<TestSyntheticBeginFrameSource> source_; 508 scoped_ptr<TestSyntheticBeginFrameSource> source_;
507 scoped_ptr<MockBeginFrameObserver> obs_; 509 scoped_ptr<MockBeginFrameObserver> obs_;
508 510
509 void SetUp() override { 511 void SetUp() override {
510 now_src_ = TestNowSource::Create(1000); 512 now_src_.reset(new base::SimpleTestTickClock());
513 now_src_->Advance(base::TimeDelta::FromMicroseconds(1000));
511 task_runner_ = 514 task_runner_ =
512 make_scoped_refptr(new OrderedSimpleTaskRunner(now_src_, false)); 515 make_scoped_refptr(new OrderedSimpleTaskRunner(now_src_.get(), false));
513 source_ = TestSyntheticBeginFrameSource::Create( 516 source_ = TestSyntheticBeginFrameSource::Create(
514 now_src_, task_runner_.get(), base::TimeDelta::FromMicroseconds(10000)); 517 now_src_.get(), task_runner_.get(),
518 base::TimeDelta::FromMicroseconds(10000));
515 obs_ = make_scoped_ptr(new MockBeginFrameObserver()); 519 obs_ = make_scoped_ptr(new MockBeginFrameObserver());
516 source_->AddObserver(obs_.get()); 520 source_->AddObserver(obs_.get());
517 } 521 }
518 522
519 void TearDown() override { obs_.reset(); } 523 void TearDown() override { obs_.reset(); }
520 }; 524 };
521 525
522 TEST_F(SyntheticBeginFrameSourceTest, 526 TEST_F(SyntheticBeginFrameSourceTest,
523 SetNeedsBeginFramesCallsOnBeginFrameWithMissedTick) { 527 SetNeedsBeginFramesCallsOnBeginFrameWithMissedTick) {
524 now_src_->SetNowMicroseconds(10010); 528 now_src_->Advance(base::TimeDelta::FromMicroseconds(9010));
525 EXPECT_CALL((*obs_), OnBeginFrame(CreateBeginFrameArgsForTesting( 529 EXPECT_CALL((*obs_), OnBeginFrame(CreateBeginFrameArgsForTesting(
526 BEGINFRAME_FROM_HERE, 10000, 20000, 10000, 530 BEGINFRAME_FROM_HERE, 10000, 20000, 10000,
527 BeginFrameArgs::MISSED))); 531 BeginFrameArgs::MISSED)));
528 source_->SetNeedsBeginFrames(true); // Should cause the last tick to be sent 532 source_->SetNeedsBeginFrames(true); // Should cause the last tick to be sent
529 // No tasks should need to be run for this to occur. 533 // No tasks should need to be run for this to occur.
530 } 534 }
531 535
532 TEST_F(SyntheticBeginFrameSourceTest, 536 TEST_F(SyntheticBeginFrameSourceTest,
533 SetNeedsBeginFramesCallsCausesOnBeginFrame) { 537 SetNeedsBeginFramesCallsCausesOnBeginFrame) {
534 source_->SetNeedsBeginFrames(true); 538 source_->SetNeedsBeginFrames(true);
535 EXPECT_EQ(10000, task_runner_->NextTaskTime().ToInternalValue()); 539 EXPECT_EQ(10000, task_runner_->NextTaskTime().ToInternalValue());
536 540
537 EXPECT_BEGIN_FRAME_USED(*obs_, 10000, 20000, 10000); 541 EXPECT_BEGIN_FRAME_USED(*obs_, 10000, 20000, 10000);
538 now_src_->SetNowMicroseconds(10010); 542 now_src_->Advance(base::TimeDelta::FromMicroseconds(9010));
539 task_runner_->RunPendingTasks(); 543 task_runner_->RunPendingTasks();
540 } 544 }
541 545
542 TEST_F(SyntheticBeginFrameSourceTest, BasicOperation) { 546 TEST_F(SyntheticBeginFrameSourceTest, BasicOperation) {
543 task_runner_->SetAutoAdvanceNowToPendingTasks(true); 547 task_runner_->SetAutoAdvanceNowToPendingTasks(true);
544 548
545 source_->SetNeedsBeginFrames(true); 549 source_->SetNeedsBeginFrames(true);
546 EXPECT_BEGIN_FRAME_USED(*obs_, 10000, 20000, 10000); 550 EXPECT_BEGIN_FRAME_USED(*obs_, 10000, 20000, 10000);
547 EXPECT_BEGIN_FRAME_USED(*obs_, 20000, 30000, 10000); 551 EXPECT_BEGIN_FRAME_USED(*obs_, 20000, 30000, 10000);
548 EXPECT_BEGIN_FRAME_USED(*obs_, 30000, 40000, 10000); 552 EXPECT_BEGIN_FRAME_USED(*obs_, 30000, 40000, 10000);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 mux_->SetActiveSource(source2_); 770 mux_->SetActiveSource(source2_);
767 SEND_BEGIN_FRAME_DROP(*source2_, 750, 1050, 300); 771 SEND_BEGIN_FRAME_DROP(*source2_, 750, 1050, 300);
768 SEND_BEGIN_FRAME_USED(*source2_, 1050, 1250, 300); 772 SEND_BEGIN_FRAME_USED(*source2_, 1050, 1250, 300);
769 773
770 mux_->SetActiveSource(source1_); 774 mux_->SetActiveSource(source1_);
771 SEND_BEGIN_FRAME_DROP(*source2_, 1100, 1400, 300); 775 SEND_BEGIN_FRAME_DROP(*source2_, 1100, 1400, 300);
772 } 776 }
773 777
774 } // namespace 778 } // namespace
775 } // namespace cc 779 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698