blob: bf3ffa79e359d93735ad9a772e461ccf5b79b5f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_
#define CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_
#include "chrome/browser/browser.h"
#include "chrome/browser/profile.h"
#include "chrome/test/testing_profile.h"
// Base class which contains a valid Browser*. Lots of boilerplate to
// recycle between unit test classes.
//
// TODO(jrg): move up a level (chrome/browser/cocoa -->
// chrome/browser), and use in non-Mac unit tests such as
// back_forward_menu_model_unittest.cc,
// navigation_controller_unittest.cc, ..
class BrowserTestHelper {
public:
BrowserTestHelper() {
profile_.reset(new TestingProfile());
profile_->CreateBookmarkModel(true);
profile_->BlockUntilBookmarkModelLoaded();
browser_.reset(new Browser(Browser::TYPE_NORMAL, profile_.get()));
}
TestingProfile* profile() const { return profile_.get(); }
Browser* browser() const { return browser_.get(); }
private:
scoped_ptr<TestingProfile> profile_;
scoped_ptr<Browser> browser_;
MessageLoopForUI message_loop_;
};
#endif // CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_
|