OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_TEST_BROWSER_TEST_BASE_H_ |
| 6 #define CONTENT_TEST_BROWSER_TEST_BASE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/compiler_specific.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 |
| 12 class BrowserTestBase : public testing::Test { |
| 13 public: |
| 14 BrowserTestBase(); |
| 15 virtual ~BrowserTestBase(); |
| 16 |
| 17 // We do this so we can be used in a Task. |
| 18 void AddRef() {} |
| 19 void Release() {} |
| 20 static bool ImplementsThreadSafeReferenceCounting() { return false; } |
| 21 |
| 22 // Configures everything for an in process browser test, then invokes |
| 23 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. |
| 24 virtual void SetUp() OVERRIDE; |
| 25 |
| 26 // Restores state configured in SetUp. |
| 27 virtual void TearDown() OVERRIDE; |
| 28 |
| 29 protected: |
| 30 // We need these special methods because SetUp is the bottom of the stack |
| 31 // that winds up calling your test method, so it is not always an option |
| 32 // to do what you want by overriding it and calling the superclass version. |
| 33 // |
| 34 // Override this for things you would normally override SetUp for. It will be |
| 35 // called before your individual test fixture method is run, but after most |
| 36 // of the overhead initialization has occured. |
| 37 virtual void SetUpInProcessBrowserTestFixture() {} |
| 38 |
| 39 // Override this for things you would normally override TearDown for. |
| 40 virtual void TearDownInProcessBrowserTestFixture() {} |
| 41 |
| 42 // Override this rather than TestBody. |
| 43 virtual void RunTestOnMainThread() = 0; |
| 44 |
| 45 // This is invoked from main after browser_init/browser_main have completed. |
| 46 // This prepares for the test by creating a new browser, runs the test |
| 47 // (RunTestOnMainThread), quits the browsers and returns. |
| 48 virtual void RunTestOnMainThreadLoop() = 0; |
| 49 |
| 50 private: |
| 51 void ProxyRunTestOnMainThreadLoop(); |
| 52 }; |
| 53 |
| 54 #endif // CONTENT_TEST_BROWSER_TEST_BASE_H_ |
OLD | NEW |