OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_IN_PROCESS_BROWSER_TEST_H_ | 5 #ifndef CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ |
6 #define CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ | 6 #define CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ |
7 | 7 |
8 #include "net/url_request/url_request_unittest.h" | 8 #include "net/url_request/url_request_unittest.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void Release() {} | 49 void Release() {} |
50 static bool ImplementsThreadSafeReferenceCounting() { return false; } | 50 static bool ImplementsThreadSafeReferenceCounting() { return false; } |
51 | 51 |
52 // Configures everything for an in process browser test, then invokes | 52 // Configures everything for an in process browser test, then invokes |
53 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. | 53 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. |
54 virtual void SetUp(); | 54 virtual void SetUp(); |
55 | 55 |
56 // Restores state configured in SetUp. | 56 // Restores state configured in SetUp. |
57 virtual void TearDown(); | 57 virtual void TearDown(); |
58 | 58 |
| 59 // This method is used to decide if user data dir |
| 60 // needs to be deleted or not. |
| 61 virtual bool ShouldDeleteProfile() { return true; } |
| 62 |
59 protected: | 63 protected: |
60 // Returns the browser created by CreateBrowser. | 64 // Returns the browser created by CreateBrowser. |
61 Browser* browser() const { return browser_; } | 65 Browser* browser() const { return browser_; } |
62 | 66 |
63 // Override this rather than TestBody. | 67 // Override this rather than TestBody. |
64 virtual void RunTestOnMainThread() = 0; | 68 virtual void RunTestOnMainThread() = 0; |
65 | 69 |
66 // Helper to initialize the user data directory. Called by SetUp() after | |
67 // erasing the user data directory, but before any browser is launched. | |
68 // If a test wishes to set up some initial non-empty state in the user | |
69 // data directory before the browser starts up, it can do so here. | |
70 virtual void SetUpUserDataDirectory() {}; | |
71 | |
72 // We need these special methods because InProcessBrowserTest::SetUp is the | 70 // We need these special methods because InProcessBrowserTest::SetUp is the |
73 // bottom of the stack that winds up calling your test method, so it is not | 71 // bottom of the stack that winds up calling your test method, so it is not |
74 // always an option to do what you want by overriding it and calling the | 72 // always an option to do what you want by overriding it and calling the |
75 // superclass version. | 73 // superclass version. |
76 // | 74 // |
77 // Override this for things you would normally override SetUp for. It will be | 75 // Override this for things you would normally override SetUp for. It will be |
78 // called before your individual test fixture method is run, but after most | 76 // called before your individual test fixture method is run, but after most |
79 // of the overhead initialization has occured. | 77 // of the overhead initialization has occured. |
80 virtual void SetUpInProcessBrowserTestFixture() {} | 78 virtual void SetUpInProcessBrowserTestFixture() {} |
81 | 79 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ | 192 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ |
195 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() | 193 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() |
196 | 194 |
197 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\ | 195 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\ |
198 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\ | 196 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\ |
199 ::testing::internal::GetTypeId<test_fixture>()) | 197 ::testing::internal::GetTypeId<test_fixture>()) |
200 | 198 |
201 #endif // defined(ALLOW_IN_PROC_BROWSER_TEST) | 199 #endif // defined(ALLOW_IN_PROC_BROWSER_TEST) |
202 | 200 |
203 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ | 201 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ |
OLD | NEW |