| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| 6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // setting up the environment for running the browser. | 59 // setting up the environment for running the browser. |
| 60 // . SetUpUserDataDirectory() | 60 // . SetUpUserDataDirectory() |
| 61 // . SetUpCommandLine() | 61 // . SetUpCommandLine() |
| 62 // . SetUpInProcessBrowserTestFixture() | 62 // . SetUpInProcessBrowserTestFixture() |
| 63 // | 63 // |
| 64 // SetUpOnMainThread() is called just after creating the default browser object | 64 // SetUpOnMainThread() is called just after creating the default browser object |
| 65 // and before executing the real test code. It's mainly for setting up things | 65 // and before executing the real test code. It's mainly for setting up things |
| 66 // related to the browser object and associated window, like opening a new Tab | 66 // related to the browser object and associated window, like opening a new Tab |
| 67 // with a testing page loaded. | 67 // with a testing page loaded. |
| 68 // | 68 // |
| 69 // CleanUpOnMainThread() is called just after executing the real test code to | 69 // TearDownOnMainThread() is called just after executing the real test code to |
| 70 // do necessary cleanup before the browser is torn down. | 70 // do necessary cleanup before the browser is torn down. |
| 71 // | 71 // |
| 72 // TearDownInProcessBrowserTestFixture() is called after BrowserMain() exits to | 72 // TearDownInProcessBrowserTestFixture() is called after BrowserMain() exits to |
| 73 // cleanup things setup for running the browser. | 73 // cleanup things setup for running the browser. |
| 74 // | 74 // |
| 75 // By default InProcessBrowserTest creates a single Browser (as returned from | 75 // By default InProcessBrowserTest creates a single Browser (as returned from |
| 76 // the CreateBrowser method). You can obviously create more as needed. | 76 // the CreateBrowser method). You can obviously create more as needed. |
| 77 | 77 |
| 78 // InProcessBrowserTest disables the sandbox when running. | 78 // InProcessBrowserTest disables the sandbox when running. |
| 79 // | 79 // |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void AddTabAtIndex(int index, const GURL& url, | 115 void AddTabAtIndex(int index, const GURL& url, |
| 116 content::PageTransition transition); | 116 content::PageTransition transition); |
| 117 | 117 |
| 118 // Initializes the contents of the user data directory. Called by SetUp() | 118 // Initializes the contents of the user data directory. Called by SetUp() |
| 119 // after creating the user data directory, but before any browser is launched. | 119 // after creating the user data directory, but before any browser is launched. |
| 120 // If a test wishes to set up some initial non-empty state in the user data | 120 // If a test wishes to set up some initial non-empty state in the user data |
| 121 // directory before the browser starts up, it can do so here. Returns true if | 121 // directory before the browser starts up, it can do so here. Returns true if |
| 122 // successful. | 122 // successful. |
| 123 virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT; | 123 virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT; |
| 124 | 124 |
| 125 // Override this to add any custom cleanup code that needs to be done on the | |
| 126 // main thread before the browser is torn down. | |
| 127 virtual void CleanUpOnMainThread() {} | |
| 128 | |
| 129 // BrowserTestBase: | 125 // BrowserTestBase: |
| 130 virtual void RunTestOnMainThreadLoop() OVERRIDE; | 126 virtual void RunTestOnMainThreadLoop() OVERRIDE; |
| 131 | 127 |
| 132 // Creates a browser with a single tab (about:blank), waits for the tab to | 128 // Creates a browser with a single tab (about:blank), waits for the tab to |
| 133 // finish loading and shows the browser. | 129 // finish loading and shows the browser. |
| 134 // | 130 // |
| 135 // This is invoked from Setup. | 131 // This is invoked from Setup. |
| 136 Browser* CreateBrowser(Profile* profile); | 132 Browser* CreateBrowser(Profile* profile); |
| 137 | 133 |
| 138 // Similar to |CreateBrowser|, but creates an incognito browser. | 134 // Similar to |CreateBrowser|, but creates an incognito browser. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 #if defined(OS_MACOSX) | 208 #if defined(OS_MACOSX) |
| 213 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; | 209 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; |
| 214 #endif // OS_MACOSX | 210 #endif // OS_MACOSX |
| 215 | 211 |
| 216 #if defined(OS_WIN) | 212 #if defined(OS_WIN) |
| 217 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | 213 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; |
| 218 #endif | 214 #endif |
| 219 }; | 215 }; |
| 220 | 216 |
| 221 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 217 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| OLD | NEW |