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

Side by Side Diff: content/test/test_browser_thread.cc

Issue 10826311: Move the corresponding cc files from content\test to be alongside their headers in content\public\t… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/test/test_browser_context.cc ('k') | content/test/test_content_client_initializer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/public/test/test_browser_thread.h"
6
7 #include "base/message_loop.h"
8 #include "base/threading/thread.h"
9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/notification_service_impl.h"
11
12 namespace content {
13
14 // This gives access to set_message_loop().
15 class TestBrowserThreadImpl : public BrowserThreadImpl {
16 public:
17 explicit TestBrowserThreadImpl(BrowserThread::ID identifier)
18 : BrowserThreadImpl(identifier),
19 notification_service_(NULL) {
20 }
21
22 TestBrowserThreadImpl(BrowserThread::ID identifier,
23 MessageLoop* message_loop)
24 : BrowserThreadImpl(identifier, message_loop),
25 notification_service_(NULL) {
26 }
27
28 virtual ~TestBrowserThreadImpl() {
29 Stop();
30 }
31
32 void set_message_loop(MessageLoop* loop) {
33 Thread::set_message_loop(loop);
34 }
35
36 virtual void Init() OVERRIDE {
37 notification_service_ = new NotificationServiceImpl;
38 BrowserThreadImpl::Init();
39 }
40
41 virtual void CleanUp() OVERRIDE {
42 delete notification_service_;
43 notification_service_ = NULL;
44 BrowserThreadImpl::CleanUp();
45 }
46
47 private:
48 NotificationService* notification_service_;
49 DISALLOW_COPY_AND_ASSIGN(TestBrowserThreadImpl);
50 };
51
52 TestBrowserThread::TestBrowserThread(BrowserThread::ID identifier)
53 : impl_(new TestBrowserThreadImpl(identifier)) {
54 }
55
56 TestBrowserThread::TestBrowserThread(BrowserThread::ID identifier,
57 MessageLoop* message_loop)
58 : impl_(new TestBrowserThreadImpl(identifier, message_loop)) {
59 }
60
61 TestBrowserThread::~TestBrowserThread() {
62 Stop();
63 }
64
65 bool TestBrowserThread::Start() {
66 return impl_->Start();
67 }
68
69 bool TestBrowserThread::StartIOThread() {
70 base::Thread::Options options;
71 options.message_loop_type = MessageLoop::TYPE_IO;
72 return impl_->StartWithOptions(options);
73 }
74
75 void TestBrowserThread::Stop() {
76 impl_->Stop();
77 }
78
79 bool TestBrowserThread::IsRunning() {
80 return impl_->IsRunning();
81 }
82
83 base::Thread* TestBrowserThread::DeprecatedGetThreadObject() {
84 return impl_.get();
85 }
86
87 void TestBrowserThread::DeprecatedSetMessageLoop(MessageLoop* loop) {
88 impl_->set_message_loop(loop);
89 }
90
91 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_browser_context.cc ('k') | content/test/test_content_client_initializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698