OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/browser.h" |
| 6 #include "chrome/browser/profile.h" |
| 7 #include "chrome/test/testing_profile.h" |
| 8 |
| 9 // Base class which contains a valid Browser*. Lots of boilerplate to |
| 10 // recycle between unit test classes. |
| 11 // |
| 12 // TODO(jrg): move up a level (chrome/browser/cocoa --> |
| 13 // chrome/browser), and use in non-Mac unit tests such as |
| 14 // back_forward_menu_model_unittest.cc, |
| 15 // navigation_controller_unittest.cc, .. |
| 16 class BrowserTestHelper { |
| 17 public: |
| 18 BrowserTestHelper() { |
| 19 TestingProfile *testing_profile = new TestingProfile(); |
| 20 testing_profile->CreateBookmarkModel(true); |
| 21 testing_profile->BlockUntilBookmarkModelLoaded(); |
| 22 profile_ = testing_profile; |
| 23 browser_ = new Browser(Browser::TYPE_NORMAL, profile_); |
| 24 } |
| 25 |
| 26 ~BrowserTestHelper() { |
| 27 delete browser_; |
| 28 delete profile_; |
| 29 } |
| 30 |
| 31 Browser* GetBrowser() { return browser_; } |
| 32 Profile* GetProfile() { return profile_; } |
| 33 |
| 34 private: |
| 35 Browser* browser_; |
| 36 Profile* profile_; |
| 37 MessageLoopForUI message_loop_; |
| 38 }; |
OLD | NEW |