OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "webkit/browser/fileapi/timed_task_helper.h" | 13 #include "webkit/browser/fileapi/timed_task_helper.h" |
14 | 14 |
15 namespace fileapi { | 15 using fileapi::TimedTaskHelper; |
| 16 |
| 17 namespace content { |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 class Embedder { | 21 class Embedder { |
20 public: | 22 public: |
21 Embedder() | 23 Embedder() |
22 : timer_(base::MessageLoopProxy::current().get()), timer_fired_(false) {} | 24 : timer_(base::MessageLoopProxy::current().get()), timer_fired_(false) {} |
23 | 25 |
24 void OnTimerFired() { | 26 void OnTimerFired() { |
25 timer_fired_ = true; | 27 timer_fired_ = true; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 base::Bind(&Embedder::OnTimerFired, base::Unretained(&embedder))); | 75 base::Bind(&Embedder::OnTimerFired, base::Unretained(&embedder))); |
74 | 76 |
75 ASSERT_TRUE(embedder.timer()->IsRunning()); | 77 ASSERT_TRUE(embedder.timer()->IsRunning()); |
76 } | 78 } |
77 | 79 |
78 // At this point the callback is still in the message queue but | 80 // At this point the callback is still in the message queue but |
79 // embedder is gone. | 81 // embedder is gone. |
80 base::RunLoop().RunUntilIdle(); | 82 base::RunLoop().RunUntilIdle(); |
81 } | 83 } |
82 | 84 |
83 } // namespace fileapi | 85 } // namespace content |
OLD | NEW |