| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_COCOA_PROFILE_TEST_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILE_TEST_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PROFILE_TEST_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PROFILE_TEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" |
| 11 #include "chrome/test/base/testing_profile_manager.h" | 11 #include "chrome/test/base/testing_profile_manager.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class TestBrowserThreadBundle; | 14 class TestBrowserThreadBundle; |
| 15 } | 15 } |
| 16 | 16 |
| 17 class Browser; | 17 class Browser; |
| 18 class TestingProfile; | 18 class TestingProfile; |
| 19 | 19 |
| 20 // Base class which contains a valid Browser*. Lots of boilerplate to | 20 // Base class which contains a valid Browser*. Lots of boilerplate to |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 ~CocoaProfileTest() override; | 37 ~CocoaProfileTest() override; |
| 38 | 38 |
| 39 // This constructs a a Browser and a TestingProfile. It is guaranteed to | 39 // This constructs a a Browser and a TestingProfile. It is guaranteed to |
| 40 // succeed, else it will ASSERT and cause the test to fail. Subclasses that | 40 // succeed, else it will ASSERT and cause the test to fail. Subclasses that |
| 41 // do work in SetUp should ASSERT that either browser() or profile() are | 41 // do work in SetUp should ASSERT that either browser() or profile() are |
| 42 // non-NULL before proceeding after the call to super (this). | 42 // non-NULL before proceeding after the call to super (this). |
| 43 void SetUp() override; | 43 void SetUp() override; |
| 44 | 44 |
| 45 void TearDown() override; | 45 void TearDown() override; |
| 46 | 46 |
| 47 TestingProfileManager* testing_profile_manager() { | 47 TestingProfileManager* testing_profile_manager() { return &profile_manager_; } |
| 48 return &profile_manager_; | |
| 49 } | |
| 50 TestingProfile* profile() { return profile_; } | 48 TestingProfile* profile() { return profile_; } |
| 51 Browser* browser() { return browser_.get(); } | 49 Browser* browser() { return browser_.get(); } |
| 52 | 50 |
| 53 // Closes the window for this browser. This will automatically be called as | 51 // Closes the window for this browser. This will automatically be called as |
| 54 // part of TearDown() if it's not been done already. | 52 // part of TearDown() if it's not been done already. |
| 55 void CloseBrowserWindow(); | 53 void CloseBrowserWindow(); |
| 56 | 54 |
| 57 protected: | 55 protected: |
| 58 // Overridden by test subclasses to create their own browser, e.g. with a | 56 // Overridden by test subclasses to create their own browser, e.g. with a |
| 59 // test window. | 57 // test window. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 private: | 69 private: |
| 72 TestingProfileManager profile_manager_; | 70 TestingProfileManager profile_manager_; |
| 73 TestingProfile* profile_; // Weak; owned by profile_manager_. | 71 TestingProfile* profile_; // Weak; owned by profile_manager_. |
| 74 TestingProfile::TestingFactories testing_factories_; | 72 TestingProfile::TestingFactories testing_factories_; |
| 75 std::unique_ptr<Browser> browser_; | 73 std::unique_ptr<Browser> browser_; |
| 76 | 74 |
| 77 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; | 75 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; |
| 78 }; | 76 }; |
| 79 | 77 |
| 80 #endif // CHROME_BROWSER_UI_COCOA_PROFILE_TEST_H_ | 78 #endif // CHROME_BROWSER_UI_COCOA_PROFILE_TEST_H_ |
| OLD | NEW |