| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SimTest_h | 5 #ifndef SimTest_h |
| 6 #define SimTest_h | 6 #define SimTest_h |
| 7 | 7 |
| 8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
| 9 #include "web/tests/FrameTestHelpers.h" | 9 #include "web/tests/FrameTestHelpers.h" |
| 10 #include "web/tests/sim/SimCompositor.h" | 10 #include "web/tests/sim/SimCompositor.h" |
| 11 #include "web/tests/sim/SimNetwork.h" | 11 #include "web/tests/sim/SimNetwork.h" |
| 12 #include "web/tests/sim/SimPage.h" | 12 #include "web/tests/sim/SimPage.h" |
| 13 #include "web/tests/sim/SimWebFrameClient.h" | 13 #include "web/tests/sim/SimWebFrameClient.h" |
| 14 #include "web/tests/sim/SimWebViewClient.h" | 14 #include "web/tests/sim/SimWebViewClient.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class WebViewBase; | 18 class WebViewBase; |
| 19 class WebLocalFrameImpl; | 19 class WebLocalFrameImpl; |
| 20 class Document; | 20 class Document; |
| 21 class LocalDOMWindow; | 21 class LocalDOMWindow; |
| 22 | 22 |
| 23 class SimTest : public ::testing::Test { | 23 class SimTest : public ::testing::Test { |
| 24 protected: | 24 protected: |
| 25 SimTest(); | 25 SimTest(); |
| 26 ~SimTest() override; | 26 ~SimTest() override; |
| 27 | 27 |
| 28 void SetUp() override; |
| 29 |
| 28 void LoadURL(const String& url); | 30 void LoadURL(const String& url); |
| 29 | 31 |
| 32 // WebView is created after SetUp to allow test to customize |
| 33 // web runtime features. |
| 34 // These methods should be accessed inside test body after a call to SetUp. |
| 30 LocalDOMWindow& Window(); | 35 LocalDOMWindow& Window(); |
| 31 SimPage& Page(); | 36 SimPage& Page(); |
| 32 Document& GetDocument(); | 37 Document& GetDocument(); |
| 33 WebViewBase& WebView(); | 38 WebViewBase& WebView(); |
| 34 WebLocalFrameImpl& MainFrame(); | 39 WebLocalFrameImpl& MainFrame(); |
| 35 const SimWebViewClient& WebViewClient() const; | 40 const SimWebViewClient& WebViewClient() const; |
| 36 SimCompositor& Compositor(); | 41 SimCompositor& Compositor(); |
| 37 | 42 |
| 38 Vector<String>& ConsoleMessages() { return console_messages_; } | 43 Vector<String>& ConsoleMessages() { return console_messages_; } |
| 39 | 44 |
| 40 private: | 45 private: |
| 41 friend class SimWebFrameClient; | 46 friend class SimWebFrameClient; |
| 42 | 47 |
| 43 void AddConsoleMessage(const String&); | 48 void AddConsoleMessage(const String&); |
| 44 | 49 |
| 45 SimNetwork network_; | 50 SimNetwork network_; |
| 46 SimCompositor compositor_; | 51 SimCompositor compositor_; |
| 47 SimWebViewClient web_view_client_; | 52 SimWebViewClient web_view_client_; |
| 48 SimWebFrameClient web_frame_client_; | 53 SimWebFrameClient web_frame_client_; |
| 49 SimPage page_; | 54 SimPage page_; |
| 50 FrameTestHelpers::WebViewHelper web_view_helper_; | 55 FrameTestHelpers::WebViewHelper web_view_helper_; |
| 51 | 56 |
| 52 Vector<String> console_messages_; | 57 Vector<String> console_messages_; |
| 53 }; | 58 }; |
| 54 | 59 |
| 55 } // namespace blink | 60 } // namespace blink |
| 56 | 61 |
| 57 #endif | 62 #endif |
| OLD | NEW |