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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "base/scoped_temp_dir.h" | 12 #include "base/scoped_temp_dir.h" |
| 13 #include "chrome/common/page_transition_types.h" |
13 #include "net/test/test_server.h" | 14 #include "net/test/test_server.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 class Browser; | 17 class Browser; |
17 class CommandLine; | 18 class CommandLine; |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 class RuleBasedHostResolverProc; | 22 class RuleBasedHostResolverProc; |
22 } | 23 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. | 61 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. |
61 virtual void SetUp(); | 62 virtual void SetUp(); |
62 | 63 |
63 // Restores state configured in SetUp. | 64 // Restores state configured in SetUp. |
64 virtual void TearDown(); | 65 virtual void TearDown(); |
65 | 66 |
66 protected: | 67 protected: |
67 // Returns the browser created by CreateBrowser. | 68 // Returns the browser created by CreateBrowser. |
68 Browser* browser() const { return browser_; } | 69 Browser* browser() const { return browser_; } |
69 | 70 |
| 71 // Convenience methods for adding tabs to a Browser. |
| 72 void AddTabAtIndexToBrowser(Browser* browser, |
| 73 int index, |
| 74 const GURL& url, |
| 75 PageTransition::Type transition); |
| 76 void AddTabAtIndex(int index, const GURL& url, |
| 77 PageTransition::Type transition); |
| 78 |
| 79 // Adds a selected tab at |index| to |url| with the specified |transition|. |
| 80 void AddTabAt(int index, const GURL& url, PageTransition::Type transition); |
| 81 |
70 // Override this rather than TestBody. | 82 // Override this rather than TestBody. |
71 virtual void RunTestOnMainThread() = 0; | 83 virtual void RunTestOnMainThread() = 0; |
72 | 84 |
73 // Initializes the contents of the user data directory. Called by SetUp() | 85 // Initializes the contents of the user data directory. Called by SetUp() |
74 // after creating the user data directory, but before any browser is launched. | 86 // after creating the user data directory, but before any browser is launched. |
75 // If a test wishes to set up some initial non-empty state in the user data | 87 // If a test wishes to set up some initial non-empty state in the user data |
76 // directory before the browser starts up, it can do so here. Returns true if | 88 // directory before the browser starts up, it can do so here. Returns true if |
77 // successful. | 89 // successful. |
78 virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT { return true; } | 90 virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT { return true; } |
79 | 91 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ | 214 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ |
203 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() | 215 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() |
204 | 216 |
205 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\ | 217 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\ |
206 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\ | 218 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\ |
207 ::testing::internal::GetTypeId<test_fixture>()) | 219 ::testing::internal::GetTypeId<test_fixture>()) |
208 | 220 |
209 #endif // defined(ALLOW_IN_PROC_BROWSER_TEST) | 221 #endif // defined(ALLOW_IN_PROC_BROWSER_TEST) |
210 | 222 |
211 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ | 223 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ |
OLD | NEW |