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

Side by Side Diff: cc/test/ordered_simple_task_runner_unittest.cc

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/test/pixel_test.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <string> 5 #include <string>
6 6
7 #include "base/cancelable_callback.h" 7 #include "base/cancelable_callback.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 EXPECT_LT(b, c); 52 EXPECT_LT(b, c);
53 EXPECT_LT(a2, c); 53 EXPECT_LT(a2, c);
54 } 54 }
55 55
56 class OrderedSimpleTaskRunnerTest : public testing::Test { 56 class OrderedSimpleTaskRunnerTest : public testing::Test {
57 public: 57 public:
58 OrderedSimpleTaskRunnerTest() 58 OrderedSimpleTaskRunnerTest()
59 : now_src_(TestNowSource::Create(base::TimeTicks())) { 59 : now_src_(TestNowSource::Create(base::TimeTicks())) {
60 task_runner_ = new OrderedSimpleTaskRunner(now_src_, true); 60 task_runner_ = new OrderedSimpleTaskRunner(now_src_, true);
61 } 61 }
62 virtual ~OrderedSimpleTaskRunnerTest() {} 62 ~OrderedSimpleTaskRunnerTest() override {}
63 63
64 protected: 64 protected:
65 std::string executed_tasks_; 65 std::string executed_tasks_;
66 scoped_refptr<TestNowSource> now_src_; 66 scoped_refptr<TestNowSource> now_src_;
67 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; 67 scoped_refptr<OrderedSimpleTaskRunner> task_runner_;
68 68
69 void PostTask(int task_num, base::TimeDelta delay) { 69 void PostTask(int task_num, base::TimeDelta delay) {
70 base::Closure test_task = base::Bind(&OrderedSimpleTaskRunnerTest::Task, 70 base::Closure test_task = base::Bind(&OrderedSimpleTaskRunnerTest::Task,
71 base::Unretained(this), 71 base::Unretained(this),
72 task_num); 72 task_num);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 task_runner_->SetRunTaskLimit(0); 438 task_runner_->SetRunTaskLimit(0);
439 RUN_AND_CHECK_RESULT(EXPECT_TRUE, RunUntilTime(run_to), ""); 439 RUN_AND_CHECK_RESULT(EXPECT_TRUE, RunUntilTime(run_to), "");
440 440
441 task_runner_->SetRunTaskLimit(100); 441 task_runner_->SetRunTaskLimit(100);
442 RUN_AND_CHECK_RESULT(EXPECT_FALSE, RunUntilTime(run_to), "4(4ms) 5(5ms)"); 442 RUN_AND_CHECK_RESULT(EXPECT_FALSE, RunUntilTime(run_to), "4(4ms) 5(5ms)");
443 EXPECT_EQ(run_to, now_src_->Now()); 443 EXPECT_EQ(run_to, now_src_->Now());
444 } 444 }
445 445
446 } // namespace cc 446 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/test/pixel_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698