| 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 "chrome/browser/sync_file_system/drive_backend/callback_helper.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/callback_helper.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 ASSERT_TRUE(called); | 27 ASSERT_TRUE(called); |
| 28 EXPECT_FALSE(*called); | 28 EXPECT_FALSE(*called); |
| 29 *called = true; | 29 *called = true; |
| 30 } | 30 } |
| 31 | 31 |
| 32 void VerifyCalledOnTaskRunner(base::TaskRunner* task_runner, | 32 void VerifyCalledOnTaskRunner(base::TaskRunner* task_runner, |
| 33 bool* called) { | 33 bool* called) { |
| 34 ASSERT_TRUE(called); | 34 ASSERT_TRUE(called); |
| 35 ASSERT_TRUE(task_runner); | 35 ASSERT_TRUE(task_runner); |
| 36 | 36 |
| 37 EXPECT_TRUE(task_runner->RunsTasksOnCurrentThread()); | 37 EXPECT_TRUE(task_runner->RunsTasksInCurrentSequence()); |
| 38 EXPECT_FALSE(*called); | 38 EXPECT_FALSE(*called); |
| 39 *called = true; | 39 *called = true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 TEST(DriveBackendCallbackHelperTest, BasicTest) { | 44 TEST(DriveBackendCallbackHelperTest, BasicTest) { |
| 45 base::MessageLoop message_loop; | 45 base::MessageLoop message_loop; |
| 46 | 46 |
| 47 bool called = false; | 47 bool called = false; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 TEST(DriveBackendCallbackHelperTest, PassNullFunctionTest) { | 92 TEST(DriveBackendCallbackHelperTest, PassNullFunctionTest) { |
| 93 base::MessageLoop message_loop; | 93 base::MessageLoop message_loop; |
| 94 base::Closure closure = RelayCallbackToCurrentThread( | 94 base::Closure closure = RelayCallbackToCurrentThread( |
| 95 FROM_HERE, | 95 FROM_HERE, |
| 96 base::Closure()); | 96 base::Closure()); |
| 97 EXPECT_TRUE(closure.is_null()); | 97 EXPECT_TRUE(closure.is_null()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace drive_backend | 100 } // namespace drive_backend |
| 101 } // namespace sync_file_system | 101 } // namespace sync_file_system |
| OLD | NEW |