| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ |
| 6 #define CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ | 6 #define CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // would never be deleted and would report as a leak under Valgrind. Note that | 21 // would never be deleted and would report as a leak under Valgrind. Note that |
| 22 // these are fake threads and they all share the same MessageLoop. | 22 // these are fake threads and they all share the same MessageLoop. |
| 23 // | 23 // |
| 24 // TODO(jrg): move up a level (chrome/browser/cocoa --> | 24 // TODO(jrg): move up a level (chrome/browser/cocoa --> |
| 25 // chrome/browser), and use in non-Mac unit tests such as | 25 // chrome/browser), and use in non-Mac unit tests such as |
| 26 // back_forward_menu_model_unittest.cc, | 26 // back_forward_menu_model_unittest.cc, |
| 27 // navigation_controller_unittest.cc, .. | 27 // navigation_controller_unittest.cc, .. |
| 28 class BrowserTestHelper { | 28 class BrowserTestHelper { |
| 29 public: | 29 public: |
| 30 BrowserTestHelper() | 30 BrowserTestHelper() |
| 31 : ui_thread_(ChromeThread::UI, &message_loop_), | 31 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 32 file_thread_(new ChromeThread(ChromeThread::FILE, &message_loop_)), | 32 file_thread_(new BrowserThread(BrowserThread::FILE, &message_loop_)), |
| 33 io_thread_(new ChromeThread(ChromeThread::IO, &message_loop_)) { | 33 io_thread_(new BrowserThread(BrowserThread::IO, &message_loop_)) { |
| 34 profile_.reset(new TestingProfile()); | 34 profile_.reset(new TestingProfile()); |
| 35 profile_->CreateBookmarkModel(true); | 35 profile_->CreateBookmarkModel(true); |
| 36 profile_->BlockUntilBookmarkModelLoaded(); | 36 profile_->BlockUntilBookmarkModelLoaded(); |
| 37 | 37 |
| 38 // TODO(shess): These are needed in case someone creates a browser | 38 // TODO(shess): These are needed in case someone creates a browser |
| 39 // window off of browser_. pkasting indicates that other | 39 // window off of browser_. pkasting indicates that other |
| 40 // platforms use a stub |BrowserWindow| and thus don't need to do | 40 // platforms use a stub |BrowserWindow| and thus don't need to do |
| 41 // this. | 41 // this. |
| 42 // http://crbug.com/39725 | 42 // http://crbug.com/39725 |
| 43 profile_->CreateAutocompleteClassifier(); | 43 profile_->CreateAutocompleteClassifier(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 browser_->CloseAllTabs(); | 77 browser_->CloseAllTabs(); |
| 78 browser_->CloseWindow(); | 78 browser_->CloseWindow(); |
| 79 // |browser_| will be deleted by its BrowserWindowController. | 79 // |browser_| will be deleted by its BrowserWindowController. |
| 80 ignore_result(browser_.release()); | 80 ignore_result(browser_.release()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 scoped_ptr<TestingProfile> profile_; | 84 scoped_ptr<TestingProfile> profile_; |
| 85 scoped_ptr<Browser> browser_; | 85 scoped_ptr<Browser> browser_; |
| 86 MessageLoopForUI message_loop_; | 86 MessageLoopForUI message_loop_; |
| 87 ChromeThread ui_thread_; | 87 BrowserThread ui_thread_; |
| 88 scoped_ptr<ChromeThread> file_thread_; | 88 scoped_ptr<BrowserThread> file_thread_; |
| 89 scoped_ptr<ChromeThread> io_thread_; | 89 scoped_ptr<BrowserThread> io_thread_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 #endif // CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ | 92 #endif // CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ |
| OLD | NEW |