Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: gin/modules/timer_unittest.cc

Issue 1848423002: Convert //gin to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gin/modules/module_registry_unittest.cc ('k') | gin/per_isolate_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory>
8
8 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
9 #include "gin/handle.h" 10 #include "gin/handle.h"
10 #include "gin/object_template_builder.h" 11 #include "gin/object_template_builder.h"
11 #include "gin/public/isolate_holder.h" 12 #include "gin/public/isolate_holder.h"
12 #include "gin/shell_runner.h" 13 #include "gin/shell_runner.h"
13 #include "gin/test/v8_test.h" 14 #include "gin/test/v8_test.h"
14 #include "gin/try_catch.h" 15 #include "gin/try_catch.h"
15 #include "gin/wrappable.h" 16 #include "gin/wrappable.h"
16 #include "v8/include/v8.h" 17 #include "v8/include/v8.h"
17 18
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 result->GetWrapper(isolate)); 65 result->GetWrapper(isolate));
65 } 66 }
66 67
67 void QuitSoon(base::MessageLoop* message_loop) { 68 void QuitSoon(base::MessageLoop* message_loop) {
68 message_loop->PostDelayedTask(FROM_HERE, 69 message_loop->PostDelayedTask(FROM_HERE,
69 base::MessageLoop::QuitWhenIdleClosure(), 70 base::MessageLoop::QuitWhenIdleClosure(),
70 base::TimeDelta::FromMilliseconds(0)); 71 base::TimeDelta::FromMilliseconds(0));
71 } 72 }
72 73
73 ShellRunnerDelegate delegate; 74 ShellRunnerDelegate delegate;
74 scoped_ptr<ShellRunner> runner; 75 std::unique_ptr<ShellRunner> runner;
75 Runner::Scope scope; 76 Runner::Scope scope;
76 Handle<TimerModule> timer_module; 77 Handle<TimerModule> timer_module;
77 Handle<Result> result; 78 Handle<Result> result;
78 }; 79 };
79 80
80 } // namespace 81 } // namespace
81 82
82 typedef V8Test TimerUnittest; 83 typedef V8Test TimerUnittest;
83 84
84 TEST_F(TimerUnittest, OneShot) { 85 TEST_F(TimerUnittest, OneShot) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Destroy runner, which should destroy the timer object we created. 146 // Destroy runner, which should destroy the timer object we created.
146 helper.QuitSoon(&message_loop_); 147 helper.QuitSoon(&message_loop_);
147 helper.runner.reset(NULL); 148 helper.runner.reset(NULL);
148 message_loop_.Run(); 149 message_loop_.Run();
149 150
150 // Timer should not have run because it was deleted. 151 // Timer should not have run because it was deleted.
151 EXPECT_EQ(0, helper.result->count()); 152 EXPECT_EQ(0, helper.result->count());
152 } 153 }
153 154
154 } // namespace gin 155 } // namespace gin
OLDNEW
« no previous file with comments | « gin/modules/module_registry_unittest.cc ('k') | gin/per_isolate_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698