| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 virtual void CleanUpOnMainThread() {} | 67 virtual void CleanUpOnMainThread() {} |
| 68 | 68 |
| 69 // Allows subclasses to configure the host mapper. By default this blocks | 69 // Allows subclasses to configure the host mapper. By default this blocks |
| 70 // requests to google.com as Chrome pings that on startup and we don't want to | 70 // requests to google.com as Chrome pings that on startup and we don't want to |
| 71 // do that during testing. | 71 // do that during testing. |
| 72 virtual void ConfigureHostMapper(net::RuleBasedHostMapper* host_mapper); | 72 virtual void ConfigureHostMapper(net::RuleBasedHostMapper* host_mapper); |
| 73 | 73 |
| 74 // Invoked when a test is not finishing in a timely manner. | 74 // Invoked when a test is not finishing in a timely manner. |
| 75 void TimedOut(); | 75 void TimedOut(); |
| 76 | 76 |
| 77 // Sets Initial Timeout value. |
| 78 void SetInitialTimeoutInMS(int initial_timeout); |
| 79 |
| 77 // Starts an HTTP server. | 80 // Starts an HTTP server. |
| 78 HTTPTestServer* StartHTTPServer(); | 81 HTTPTestServer* StartHTTPServer(); |
| 79 | 82 |
| 80 // Creates a browser with a single tab (about:blank), waits for the tab to | 83 // Creates a browser with a single tab (about:blank), waits for the tab to |
| 81 // finish loading and shows the browser. | 84 // finish loading and shows the browser. |
| 82 // | 85 // |
| 83 // This is invoked from Setup. | 86 // This is invoked from Setup. |
| 84 virtual Browser* CreateBrowser(Profile* profile); | 87 virtual Browser* CreateBrowser(Profile* profile); |
| 85 | 88 |
| 86 // Sets some test states (see below for comments). Call this in your test | 89 // Sets some test states (see below for comments). Call this in your test |
| (...skipping 24 matching lines...) Expand all Loading... |
| 111 // Whether to run the test in single-process mode. | 114 // Whether to run the test in single-process mode. |
| 112 bool single_process_; | 115 bool single_process_; |
| 113 | 116 |
| 114 // We muck with the global command line for this process. Keep the original | 117 // We muck with the global command line for this process. Keep the original |
| 115 // so we can reset it when we're done. | 118 // so we can reset it when we're done. |
| 116 scoped_ptr<CommandLine> original_command_line_; | 119 scoped_ptr<CommandLine> original_command_line_; |
| 117 | 120 |
| 118 // Saved to restore the value of RenderProcessHost::run_renderer_in_process. | 121 // Saved to restore the value of RenderProcessHost::run_renderer_in_process. |
| 119 bool original_single_process_; | 122 bool original_single_process_; |
| 120 | 123 |
| 124 // Initial timeout value in ms. |
| 125 int initial_timeout_; |
| 126 |
| 121 DISALLOW_COPY_AND_ASSIGN(InProcessBrowserTest); | 127 DISALLOW_COPY_AND_ASSIGN(InProcessBrowserTest); |
| 122 }; | 128 }; |
| 123 | 129 |
| 124 #define IN_PROC_BROWSER_TEST_(test_case_name, test_name, parent_class,\ | 130 #define IN_PROC_BROWSER_TEST_(test_case_name, test_name, parent_class,\ |
| 125 parent_id)\ | 131 parent_id)\ |
| 126 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\ | 132 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\ |
| 127 public:\ | 133 public:\ |
| 128 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\ | 134 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\ |
| 129 protected:\ | 135 protected:\ |
| 130 virtual void RunTestOnMainThread();\ | 136 virtual void RunTestOnMainThread();\ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 144 parent_class::TearDownTestCase, \ | 150 parent_class::TearDownTestCase, \ |
| 145 new ::testing::internal::TestFactoryImpl<\ | 151 new ::testing::internal::TestFactoryImpl<\ |
| 146 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ | 152 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ |
| 147 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() | 153 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() |
| 148 | 154 |
| 149 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\ | 155 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\ |
| 150 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\ | 156 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\ |
| 151 ::testing::internal::GetTypeId<test_fixture>()) | 157 ::testing::internal::GetTypeId<test_fixture>()) |
| 152 | 158 |
| 153 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ | 159 #endif // CHROME_TEST_IN_PROCESS_BROWSER_TEST_H_ |
| OLD | NEW |