OLD | NEW |
(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_bundle.h" |
| 6 |
| 7 #include "content/public/test/test_browser_thread_bundle.h" |
| 8 |
| 9 namespace web { |
| 10 |
| 11 namespace { |
| 12 |
| 13 int TestBrowserThreadBundleOptionsFromTestWebThreadBundleOptions(int options) { |
| 14 int result = 0; |
| 15 if (options & TestWebThreadBundle::IO_MAINLOOP) |
| 16 result |= content::TestBrowserThreadBundle::IO_MAINLOOP; |
| 17 if (options & TestWebThreadBundle::REAL_DB_THREAD) |
| 18 result |= content::TestBrowserThreadBundle::REAL_DB_THREAD; |
| 19 if (options & TestWebThreadBundle::REAL_FILE_THREAD) |
| 20 result |= content::TestBrowserThreadBundle::REAL_FILE_THREAD; |
| 21 if (options & TestWebThreadBundle::REAL_FILE_USER_BLOCKING_THREAD) |
| 22 result |= content::TestBrowserThreadBundle::REAL_FILE_USER_BLOCKING_THREAD; |
| 23 if (options & TestWebThreadBundle::REAL_CACHE_THREAD) |
| 24 result |= content::TestBrowserThreadBundle::REAL_CACHE_THREAD; |
| 25 if (options & TestWebThreadBundle::REAL_IO_THREAD) |
| 26 result |= content::TestBrowserThreadBundle::REAL_IO_THREAD; |
| 27 return result; |
| 28 } |
| 29 |
| 30 } // namespace |
| 31 |
| 32 class TestWebThreadBundleImpl { |
| 33 public: |
| 34 explicit TestWebThreadBundleImpl(int options) |
| 35 : test_browser_thread_bundle_( |
| 36 TestBrowserThreadBundleOptionsFromTestWebThreadBundleOptions( |
| 37 options)) {} |
| 38 |
| 39 private: |
| 40 content::TestBrowserThreadBundle test_browser_thread_bundle_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(TestWebThreadBundleImpl); |
| 43 }; |
| 44 |
| 45 TestWebThreadBundle::TestWebThreadBundle() |
| 46 : impl_(new TestWebThreadBundleImpl(DEFAULT)) { |
| 47 } |
| 48 |
| 49 TestWebThreadBundle::TestWebThreadBundle(int options) |
| 50 : impl_(new TestWebThreadBundleImpl(options)) { |
| 51 } |
| 52 |
| 53 TestWebThreadBundle::~TestWebThreadBundle() { |
| 54 } |
| 55 |
| 56 } // namespace web |
OLD | NEW |