| 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 | 7 |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| 11 #include "chrome/test/testing_profile.h" | 11 #include "chrome/test/testing_profile.h" |
| 12 | 12 |
| 13 // Base class which contains a valid Browser*. Lots of boilerplate to | 13 // Base class which contains a valid Browser*. Lots of boilerplate to |
| 14 // recycle between unit test classes. | 14 // recycle between unit test classes. |
| 15 // | 15 // |
| 16 // TODO(jrg): move up a level (chrome/browser/cocoa --> | 16 // TODO(jrg): move up a level (chrome/browser/cocoa --> |
| 17 // chrome/browser), and use in non-Mac unit tests such as | 17 // chrome/browser), and use in non-Mac unit tests such as |
| 18 // back_forward_menu_model_unittest.cc, | 18 // back_forward_menu_model_unittest.cc, |
| 19 // navigation_controller_unittest.cc, .. | 19 // navigation_controller_unittest.cc, .. |
| 20 class BrowserTestHelper { | 20 class BrowserTestHelper { |
| 21 public: | 21 public: |
| 22 BrowserTestHelper() | 22 BrowserTestHelper() |
| 23 : ui_thread_(ChromeThread::UI, &message_loop_), | 23 : ui_thread_(ChromeThread::UI, &message_loop_), |
| 24 file_thread_(ChromeThread::FILE, &message_loop_) { | 24 file_thread_(ChromeThread::FILE, &message_loop_), |
| 25 io_thread_(ChromeThread::IO, &message_loop_) { |
| 25 profile_.reset(new TestingProfile()); | 26 profile_.reset(new TestingProfile()); |
| 26 profile_->CreateBookmarkModel(true); | 27 profile_->CreateBookmarkModel(true); |
| 27 profile_->BlockUntilBookmarkModelLoaded(); | 28 profile_->BlockUntilBookmarkModelLoaded(); |
| 28 | 29 |
| 29 // TODO(shess): These are needed in case someone creates a browser | 30 // TODO(shess): These are needed in case someone creates a browser |
| 30 // window off of browser_. pkasting indicates that other | 31 // window off of browser_. pkasting indicates that other |
| 31 // platforms use a stub |BrowserWindow| and thus don't need to do | 32 // platforms use a stub |BrowserWindow| and thus don't need to do |
| 32 // this. | 33 // this. |
| 33 // http://crbug.com/39725 | 34 // http://crbug.com/39725 |
| 34 profile_->CreateAutocompleteClassifier(); | 35 profile_->CreateAutocompleteClassifier(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 65 // |browser_| will be deleted by its BrowserWindowController. | 66 // |browser_| will be deleted by its BrowserWindowController. |
| 66 ignore_result(browser_.release()); | 67 ignore_result(browser_.release()); |
| 67 } | 68 } |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 scoped_ptr<TestingProfile> profile_; | 71 scoped_ptr<TestingProfile> profile_; |
| 71 scoped_ptr<Browser> browser_; | 72 scoped_ptr<Browser> browser_; |
| 72 MessageLoopForUI message_loop_; | 73 MessageLoopForUI message_loop_; |
| 73 ChromeThread ui_thread_; | 74 ChromeThread ui_thread_; |
| 74 ChromeThread file_thread_; | 75 ChromeThread file_thread_; |
| 76 ChromeThread io_thread_; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 #endif // CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ | 79 #endif // CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ |
| OLD | NEW |