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

Side by Side Diff: content/browser/browser_thread_unittest.cc

Issue 2721223004: Fix for BrowserThreadTest tests (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 11 matching lines...) Expand all
22 class BrowserThreadTest : public testing::Test { 22 class BrowserThreadTest : public testing::Test {
23 public: 23 public:
24 void Release() const { 24 void Release() const {
25 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 25 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
26 loop_.task_runner()->PostTask(FROM_HERE, 26 loop_.task_runner()->PostTask(FROM_HERE,
27 base::MessageLoop::QuitWhenIdleClosure()); 27 base::MessageLoop::QuitWhenIdleClosure());
28 } 28 }
29 29
30 void StopUIThread() { ui_thread_->Stop(); } 30 void StopUIThread() { ui_thread_->Stop(); }
31 31
32 ~BrowserThreadTest() override {
33 ui_thread_ = nullptr;
jam 2017/03/02 01:07:04 nit: put it in Teardown to match Setup, i.e. move
34 file_thread_ = nullptr;
35 BrowserThreadImpl::ResetGlobalsForTesting(BrowserThread::UI);
36 BrowserThreadImpl::ResetGlobalsForTesting(BrowserThread::FILE);
37 }
38
32 protected: 39 protected:
33 void SetUp() override { 40 void SetUp() override {
34 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI)); 41 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI));
35 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE)); 42 file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE));
36 ui_thread_->Start(); 43 ui_thread_->Start();
37 file_thread_->Start(); 44 file_thread_->Start();
38 } 45 }
39 46
40 void TearDown() override { 47 void TearDown() override {
41 StopUIThread(); 48 StopUIThread();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 UIThreadDestructionObserver observer(&did_shutdown, loop.QuitClosure()); 173 UIThreadDestructionObserver observer(&did_shutdown, loop.QuitClosure());
167 base::ThreadTaskRunnerHandle::Get()->PostTask( 174 base::ThreadTaskRunnerHandle::Get()->PostTask(
168 FROM_HERE, 175 FROM_HERE,
169 base::Bind(&BrowserThreadTest::StopUIThread, base::Unretained(this))); 176 base::Bind(&BrowserThreadTest::StopUIThread, base::Unretained(this)));
170 loop.Run(); 177 loop.Run();
171 178
172 EXPECT_TRUE(did_shutdown); 179 EXPECT_TRUE(did_shutdown);
173 } 180 }
174 181
175 } // namespace content 182 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698