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_TEST_BROWSER_TEST_BASE_H_ | 5 #ifndef CONTENT_TEST_BROWSER_TEST_BASE_H_ |
6 #define CONTENT_TEST_BROWSER_TEST_BASE_H_ | 6 #define CONTENT_TEST_BROWSER_TEST_BASE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "net/test/test_server.h" | 10 #include "net/test/test_server.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 // This is invoked from main after browser_init/browser_main have completed. | 54 // This is invoked from main after browser_init/browser_main have completed. |
55 // This prepares for the test by creating a new browser, runs the test | 55 // This prepares for the test by creating a new browser, runs the test |
56 // (RunTestOnMainThread), quits the browsers and returns. | 56 // (RunTestOnMainThread), quits the browsers and returns. |
57 virtual void RunTestOnMainThreadLoop() = 0; | 57 virtual void RunTestOnMainThreadLoop() = 0; |
58 | 58 |
59 // Returns the testing server. Guaranteed to be non-NULL. | 59 // Returns the testing server. Guaranteed to be non-NULL. |
60 const net::TestServer* test_server() const { return test_server_.get(); } | 60 const net::TestServer* test_server() const { return test_server_.get(); } |
61 net::TestServer* test_server() { return test_server_.get(); } | 61 net::TestServer* test_server() { return test_server_.get(); } |
62 | 62 |
| 63 #if defined(OS_POSIX) |
| 64 // This is only needed by a test that raises SIGTERM to ensure that a specific |
| 65 // codepath is taken. |
| 66 void DisableSIGTERMHandling() { |
| 67 handle_sigterm_ = false; |
| 68 } |
| 69 #endif |
| 70 |
63 // This function is meant only for classes that directly derive from this | 71 // This function is meant only for classes that directly derive from this |
64 // class to construct the test server in their constructor. They might need to | 72 // class to construct the test server in their constructor. They might need to |
65 // call this after setting up the paths. Actual test cases should never call | 73 // call this after setting up the paths. Actual test cases should never call |
66 // this. | 74 // this. |
67 // |test_server_base| is the path, relative to src, to give to the test HTTP | 75 // |test_server_base| is the path, relative to src, to give to the test HTTP |
68 // server. | 76 // server. |
69 void CreateTestServer(const char* test_server_base); | 77 void CreateTestServer(const char* test_server_base); |
70 | 78 |
71 private: | 79 private: |
72 void ProxyRunTestOnMainThreadLoop(); | 80 void ProxyRunTestOnMainThreadLoop(); |
73 | 81 |
74 // Testing server, started on demand. | 82 // Testing server, started on demand. |
75 scoped_ptr<net::TestServer> test_server_; | 83 scoped_ptr<net::TestServer> test_server_; |
| 84 |
| 85 #if defined(OS_POSIX) |
| 86 bool handle_sigterm_; |
| 87 #endif |
76 }; | 88 }; |
77 | 89 |
78 #endif // CONTENT_TEST_BROWSER_TEST_BASE_H_ | 90 #endif // CONTENT_TEST_BROWSER_TEST_BASE_H_ |
OLD | NEW |