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 CONTENT_PUBLIC_TEST_BROWSER_TEST_BASE_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_BASE_H_ |
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_BASE_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_BASE_H_ |
7 | 7 |
| 8 #include "base/callback.h" |
8 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "net/test/test_server.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "net/test/test_server.h" | |
11 | 12 |
12 class CommandLine; | 13 class CommandLine; |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class FilePath; | 16 class FilePath; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class BrowserTestBase : public testing::Test { | 21 class BrowserTestBase : public testing::Test { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #endif | 76 #endif |
76 | 77 |
77 // This function is meant only for classes that directly derive from this | 78 // This function is meant only for classes that directly derive from this |
78 // class to construct the test server in their constructor. They might need to | 79 // class to construct the test server in their constructor. They might need to |
79 // call this after setting up the paths. Actual test cases should never call | 80 // call this after setting up the paths. Actual test cases should never call |
80 // this. | 81 // this. |
81 // |test_server_base| is the path, relative to src, to give to the test HTTP | 82 // |test_server_base| is the path, relative to src, to give to the test HTTP |
82 // server. | 83 // server. |
83 void CreateTestServer(const base::FilePath& test_server_base); | 84 void CreateTestServer(const base::FilePath& test_server_base); |
84 | 85 |
| 86 // When the test is running in --single-process mode, runs the given task on |
| 87 // the in-process renderer thread. A nested message loop is run until it |
| 88 // returns. |
| 89 void PostTaskToInProcessRendererAndWait(const base::Closure& task); |
| 90 |
85 private: | 91 private: |
86 void ProxyRunTestOnMainThreadLoop(); | 92 void ProxyRunTestOnMainThreadLoop(); |
87 | 93 |
88 // Testing server, started on demand. | 94 // Testing server, started on demand. |
89 scoped_ptr<net::TestServer> test_server_; | 95 scoped_ptr<net::TestServer> test_server_; |
90 | 96 |
91 #if defined(OS_POSIX) | 97 #if defined(OS_POSIX) |
92 bool handle_sigterm_; | 98 bool handle_sigterm_; |
93 #endif | 99 #endif |
94 }; | 100 }; |
95 | 101 |
96 } // namespace content | 102 } // namespace content |
97 | 103 |
98 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_BASE_H_ | 104 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_BASE_H_ |
OLD | NEW |