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

Side by Side Diff: chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc

Issue 10874054: Add WARN_UNUSED_RESULT to scoped_refptr::release. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Don't assign NULL to pointer to scoped_refptr. Created 8 years, 3 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 | « base/memory/ref_counted.h ('k') | chrome/browser/ui/webui/tracing_ui.cc » ('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 (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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 BrowserThread::IO, FROM_HERE, MessageLoop::QuitClosure()); 71 BrowserThread::IO, FROM_HERE, MessageLoop::QuitClosure());
72 } 72 }
73 73
74 protected: 74 protected:
75 virtual void SetUp() { 75 virtual void SetUp() {
76 db_thread_.Start(); 76 db_thread_.Start();
77 worker_ = new DatabaseModelWorker(); 77 worker_ = new DatabaseModelWorker();
78 } 78 }
79 79
80 virtual void Teardown() { 80 virtual void Teardown() {
81 worker_.release(); 81 worker_ = NULL;
82 db_thread_.Stop(); 82 db_thread_.Stop();
83 } 83 }
84 84
85 private: 85 private:
86 bool did_do_work_; 86 bool did_do_work_;
87 scoped_refptr<BrowserThreadModelWorker> worker_; 87 scoped_refptr<BrowserThreadModelWorker> worker_;
88 OneShotTimer<SyncBrowserThreadModelWorkerTest> timer_; 88 OneShotTimer<SyncBrowserThreadModelWorkerTest> timer_;
89 89
90 content::TestBrowserThread db_thread_; 90 content::TestBrowserThread db_thread_;
91 MessageLoopForIO io_loop_; 91 MessageLoopForIO io_loop_;
92 content::TestBrowserThread io_thread_; 92 content::TestBrowserThread io_thread_;
93 93
94 base::WeakPtrFactory<SyncBrowserThreadModelWorkerTest> weak_factory_; 94 base::WeakPtrFactory<SyncBrowserThreadModelWorkerTest> weak_factory_;
95 }; 95 };
96 96
97 TEST_F(SyncBrowserThreadModelWorkerTest, DoesWorkOnDatabaseThread) { 97 TEST_F(SyncBrowserThreadModelWorkerTest, DoesWorkOnDatabaseThread) {
98 MessageLoop::current()->PostTask(FROM_HERE, 98 MessageLoop::current()->PostTask(FROM_HERE,
99 base::Bind(&SyncBrowserThreadModelWorkerTest::ScheduleWork, 99 base::Bind(&SyncBrowserThreadModelWorkerTest::ScheduleWork,
100 factory()->GetWeakPtr())); 100 factory()->GetWeakPtr()));
101 MessageLoop::current()->Run(); 101 MessageLoop::current()->Run();
102 EXPECT_TRUE(did_do_work()); 102 EXPECT_TRUE(did_do_work());
103 } 103 }
104 104
105 } // namespace 105 } // namespace
106 106
107 } // namespace browser_sync 107 } // namespace browser_sync
OLDNEW
« no previous file with comments | « base/memory/ref_counted.h ('k') | chrome/browser/ui/webui/tracing_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698