| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 BLIMP_TEST_BROWSER_TESTS_BLIMP_BROWSER_TEST_H_ |
| 6 #define BLIMP_TEST_BROWSER_TESTS_BLIMP_BROWSER_TEST_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "content/public/test/browser_test_base.h" |
| 11 |
| 12 namespace base { |
| 13 class RunLoop; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 class WebContents; |
| 18 } |
| 19 |
| 20 namespace blimp { |
| 21 namespace client { |
| 22 struct Assignment; |
| 23 } // namespace client |
| 24 |
| 25 namespace engine { |
| 26 class BlimpEngineSession; |
| 27 } // namespace engine |
| 28 |
| 29 // Base class for tests which require a full instance of the Blimp engine. |
| 30 class BlimpBrowserTest : public content::BrowserTestBase { |
| 31 public: |
| 32 // Notify that an asynchronous test is now complete and the test runner should |
| 33 // exit. |
| 34 void QuitRunLoop(); |
| 35 |
| 36 protected: |
| 37 BlimpBrowserTest(); |
| 38 ~BlimpBrowserTest() override; |
| 39 |
| 40 // Run an asynchronous test in a nested run loop. The caller should call |
| 41 // QuitRunLoop() to notify that the test should finish. |
| 42 void RunUntilQuit(); |
| 43 |
| 44 engine::BlimpEngineSession* GetEngineSession(); |
| 45 |
| 46 client::Assignment GetClientAssignment(); |
| 47 |
| 48 // testing::Test implementation. |
| 49 void SetUp() override; |
| 50 |
| 51 // content::BrowserTestBase implementation. |
| 52 void RunTestOnMainThreadLoop() override; |
| 53 void SetUpOnMainThread() override; |
| 54 void TearDownOnMainThread() override; |
| 55 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 56 |
| 57 private: |
| 58 void OnGetEnginePort(uint16_t port); |
| 59 |
| 60 uint16_t engine_port_; |
| 61 std::unique_ptr<base::RunLoop> run_loop_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserTest); |
| 64 }; |
| 65 |
| 66 } // namespace blimp |
| 67 |
| 68 #endif // BLIMP_TEST_BROWSER_TESTS_BLIMP_BROWSER_TEST_H_ |
| OLD | NEW |