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 "gin/modules/timer.h" | 5 #include "gin/modules/timer.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "gin/handle.h" | 9 #include "gin/handle.h" |
10 #include "gin/object_template_builder.h" | 10 #include "gin/object_template_builder.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
37 Result() : count_(0) { | 37 Result() : count_(0) { |
38 } | 38 } |
39 | 39 |
40 virtual ~Result() { | 40 virtual ~Result() { |
41 } | 41 } |
42 | 42 |
43 virtual ObjectTemplateBuilder GetObjectTemplateBuilder( | 43 virtual ObjectTemplateBuilder GetObjectTemplateBuilder( |
44 v8::Isolate* isolate) OVERRIDE { | 44 v8::Isolate* isolate) override { |
45 return Wrappable<Result>::GetObjectTemplateBuilder(isolate) | 45 return Wrappable<Result>::GetObjectTemplateBuilder(isolate) |
46 .SetProperty("count", &Result::count, &Result::set_count) | 46 .SetProperty("count", &Result::count, &Result::set_count) |
47 .SetMethod("quit", &Result::Quit); | 47 .SetMethod("quit", &Result::Quit); |
48 } | 48 } |
49 | 49 |
50 int count_; | 50 int count_; |
51 }; | 51 }; |
52 | 52 |
53 WrapperInfo Result::kWrapperInfo = { gin::kEmbedderNativeGin }; | 53 WrapperInfo Result::kWrapperInfo = { gin::kEmbedderNativeGin }; |
54 | 54 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Destroy runner, which should destroy the timer object we created. | 146 // Destroy runner, which should destroy the timer object we created. |
147 helper.QuitSoon(); | 147 helper.QuitSoon(); |
148 helper.runner.reset(NULL); | 148 helper.runner.reset(NULL); |
149 helper.loop.Run(); | 149 helper.loop.Run(); |
150 | 150 |
151 // Timer should not have run because it was deleted. | 151 // Timer should not have run because it was deleted. |
152 EXPECT_EQ(0, helper.result->count()); | 152 EXPECT_EQ(0, helper.result->count()); |
153 } | 153 } |
154 | 154 |
155 } // namespace gin | 155 } // namespace gin |
OLD | NEW |