Index: content/public/test/browser_test_base.h |
diff --git a/content/public/test/browser_test_base.h b/content/public/test/browser_test_base.h |
index 1514c65062ee50ec668b1c6f37e472e98e7c7f10..a350241a6ca020f1e8c2a458d766164ffb6244b2 100644 |
--- a/content/public/test/browser_test_base.h |
+++ b/content/public/test/browser_test_base.h |
@@ -7,6 +7,7 @@ |
#include "base/callback.h" |
#include "base/compiler_specific.h" |
+#include "base/memory/scoped_vector.h" |
#include "base/threading/thread.h" |
#include "net/test/spawned_test_server/spawned_test_server.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -28,6 +29,27 @@ namespace content { |
class BrowserTestBase : public testing::Test { |
public: |
+ // Class that can be used to add some features not related directly |
+ // to the testing process and do set ups needed for them in proper time. |
+ // To do this you need to derive Admixture, implement |
+ // all the methods you need there and (if needed) reload set ups and tear |
+ // downs |
+ // for things that you would usually do in those of the test, but which are |
+ // connected |
+ // to the admixture, not to the test itself. |
+ // Finally, AddAdmixture() should be called in the test's constructor for each |
+ // Admixture. |
+ class Admixture { |
+ public: |
+ Admixture() {} |
+ virtual ~Admixture() {} |
+ virtual void SetUpCommandLine(base::CommandLine* command_line) {} |
+ virtual void SetUpOnMainThread() {} |
+ virtual void SetUpInProcessBrowserTestFixture() {} |
+ virtual void TearDownOnMainThread() {} |
+ virtual void TearDownInProcessBrowserTestFixture() {} |
+ }; |
+ |
BrowserTestBase(); |
virtual ~BrowserTestBase(); |
@@ -130,6 +152,15 @@ class BrowserTestBase : public testing::Test { |
// Returns true if the test will be using GL acceleration via OSMesa. |
bool UsingOSMesa() const; |
+ // Adds |admixture| as an admixture for this test, passing ownership |
+ // for it to BrowserTestBase. |
+ // Should be called in constructor of the test (should be already completed |
+ // before running set ups). |
+ void AddAdmixture(Admixture* admixture); |
+ |
+ // Returns admixtures for this test. |
+ std::vector<BrowserTestBase::Admixture*> GetAdmixtures(); |
+ |
private: |
void ProxyRunTestOnMainThreadLoop(); |
@@ -142,6 +173,9 @@ class BrowserTestBase : public testing::Test { |
// Host resolver used during tests. |
scoped_refptr<net::RuleBasedHostResolverProc> rule_based_resolver_; |
+ // Holds admixtures for this test. |
+ ScopedVector<Admixture> admixtures_; |
+ |
// Expected exit code (default is 0). |
int expected_exit_code_; |