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

Side by Side Diff: ios/web/test/test_web_thread_adapter.cc

Issue 1406983008: [iOS] ios/web no longer depends on content::BrowserThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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 | « ios/web/public/web_thread.h ('k') | ios/web/test/test_web_thread_bundle.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 2014 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 "ios/web/public/test/test_web_thread.h"
6
7 #include "content/public/test/test_browser_thread.h"
8 #include "ios/web/web_thread_adapter.h"
9
10 namespace web {
11
12 // TestWebThreadImpl delegates to content::TestBrowserThread until WebThread
13 // implementation is indenpendent of content::BrowserThread.
14 class TestWebThreadImpl {
15 public:
16 TestWebThreadImpl(WebThread::ID identifier)
17 : test_browser_thread_(BrowserThreadIDFromWebThreadID(identifier)) {}
18
19 TestWebThreadImpl(WebThread::ID identifier, base::MessageLoop* message_loop)
20 : test_browser_thread_(BrowserThreadIDFromWebThreadID(identifier),
21 message_loop) {}
22
23 ~TestWebThreadImpl() { Stop(); }
24
25 bool Start() { return test_browser_thread_.Start(); }
26
27 bool StartIOThread() { return test_browser_thread_.StartIOThread(); }
28
29 void Stop() { test_browser_thread_.Stop(); }
30
31 bool IsRunning() { return test_browser_thread_.IsRunning(); }
32
33 private:
34 content::TestBrowserThread test_browser_thread_;
35 };
36
37 TestWebThread::TestWebThread(WebThread::ID identifier)
38 : impl_(new TestWebThreadImpl(identifier)) {
39 }
40
41 TestWebThread::TestWebThread(WebThread::ID identifier,
42 base::MessageLoop* message_loop)
43 : impl_(new TestWebThreadImpl(identifier, message_loop)) {
44 }
45
46 TestWebThread::~TestWebThread() {
47 }
48
49 bool TestWebThread::Start() {
50 return impl_->Start();
51 }
52
53 bool TestWebThread::StartIOThread() {
54 return impl_->StartIOThread();
55 }
56
57 void TestWebThread::Stop() {
58 impl_->Stop();
59 }
60
61 bool TestWebThread::IsRunning() {
62 return impl_->IsRunning();
63 }
64
65 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/public/web_thread.h ('k') | ios/web/test/test_web_thread_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698