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/safe_browsing/incident_reporting/delayed_callback_runne
r.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/delayed_callback_runne
r.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/test/test_simple_task_runner.h" | 14 #include "base/test/test_simple_task_runner.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // A class of objects that invoke a callback upon destruction. This is used as | 20 // A class of objects that invoke a callback upon destruction. This is used as |
21 // an owned argument on callbacks given to a DelayedCallbackRunner under test. | 21 // an owned argument on callbacks given to a DelayedCallbackRunner under test. |
22 class CallbackArgument { | 22 class CallbackArgument { |
23 public: | 23 public: |
24 explicit CallbackArgument(const base::Closure& on_delete) | 24 explicit CallbackArgument(const base::Closure& on_delete) |
25 : on_delete_(on_delete) {} | 25 : on_delete_(on_delete) {} |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 task_runner_->RunUntilIdle(); | 154 task_runner_->RunUntilIdle(); |
155 EXPECT_TRUE(CallbackWasRun(name)); | 155 EXPECT_TRUE(CallbackWasRun(name)); |
156 EXPECT_TRUE(CallbackWasDeleted(name)); | 156 EXPECT_TRUE(CallbackWasDeleted(name)); |
157 | 157 |
158 RegisterTestCallback(name2); | 158 RegisterTestCallback(name2); |
159 instance_->Start(); | 159 instance_->Start(); |
160 task_runner_->RunUntilIdle(); | 160 task_runner_->RunUntilIdle(); |
161 EXPECT_TRUE(CallbackWasRun(name2)); | 161 EXPECT_TRUE(CallbackWasRun(name2)); |
162 EXPECT_TRUE(CallbackWasDeleted(name2)); | 162 EXPECT_TRUE(CallbackWasDeleted(name2)); |
163 } | 163 } |
OLD | NEW |