| OLD | NEW |
| 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 "cc/test/ordered_simple_task_runner.h" | 5 #include "cc/test/ordered_simple_task_runner.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/test/test_pending_task.h" | 14 #include "base/test/test_pending_task.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 // We pass EXPECT_TRUE / EXPECT_FALSE macros rather than a boolean as on some | 17 // We pass EXPECT_TRUE / EXPECT_FALSE macros rather than a boolean as on some |
| 18 // compilers EXPECT_EQ(false, XXXX) fails to compile as gtest tries to convert | 18 // compilers EXPECT_EQ(false, XXXX) fails to compile as gtest tries to convert |
| 19 // the false value to null causing a -Werror=conversion-null error. | 19 // the false value to null causing a -Werror=conversion-null error. |
| 20 #define RUN_AND_CHECK_RESULT( \ | 20 #define RUN_AND_CHECK_RESULT( \ |
| 21 tasks_remain_expect_macro, run_func, expected_result) \ | 21 tasks_remain_expect_macro, run_func, expected_result) \ |
| 22 tasks_remain_expect_macro(task_runner_->run_func); \ | 22 tasks_remain_expect_macro(task_runner_->run_func); \ |
| 23 EXPECT_EQ(expected_result, executed_tasks_); \ | 23 EXPECT_EQ(expected_result, executed_tasks_); \ |
| 24 executed_tasks_ = ""; | 24 executed_tasks_ = ""; |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 bool ReturnTrue() { | 28 bool ReturnTrue() { |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 436 |
| 437 task_runner_->SetRunTaskLimit(0); | 437 task_runner_->SetRunTaskLimit(0); |
| 438 RUN_AND_CHECK_RESULT(EXPECT_TRUE, RunUntilTime(run_to), ""); | 438 RUN_AND_CHECK_RESULT(EXPECT_TRUE, RunUntilTime(run_to), ""); |
| 439 | 439 |
| 440 task_runner_->SetRunTaskLimit(100); | 440 task_runner_->SetRunTaskLimit(100); |
| 441 RUN_AND_CHECK_RESULT(EXPECT_FALSE, RunUntilTime(run_to), "4(4ms) 5(5ms)"); | 441 RUN_AND_CHECK_RESULT(EXPECT_FALSE, RunUntilTime(run_to), "4(4ms) 5(5ms)"); |
| 442 EXPECT_EQ(run_to, now_src_->NowTicks()); | 442 EXPECT_EQ(run_to, now_src_->NowTicks()); |
| 443 } | 443 } |
| 444 | 444 |
| 445 } // namespace cc | 445 } // namespace cc |
| OLD | NEW |