| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "base/values.h" | 5 #include "base/values.h" |
| 6 #include "extensions/browser/guest_view/test_guest_view_manager.h" | 6 #include "components/guest_view/browser/test_guest_view_manager.h" |
| 7 #include "extensions/shell/test/shell_test.h" | 7 #include "extensions/shell/test/shell_test.h" |
| 8 #include "ui/gfx/switches.h" | 8 #include "ui/gfx/switches.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 class WebContents; | 11 class WebContents; |
| 12 } // namespace content | 12 } // namespace content |
| 13 | 13 |
| 14 namespace guestview { |
| 15 class TestGuestViewManager; |
| 16 } // namesapce guestview |
| 17 |
| 14 namespace extensions { | 18 namespace extensions { |
| 15 class TestGuestViewManager; | |
| 16 | 19 |
| 17 // Base class for WebView tests in app_shell. | 20 // Base class for WebView tests in app_shell. |
| 18 class WebViewAPITest : public AppShellTest { | 21 class WebViewAPITest : public AppShellTest { |
| 19 protected: | 22 protected: |
| 20 WebViewAPITest(); | 23 WebViewAPITest(); |
| 21 | 24 |
| 22 // Launches the app_shell app in |app_location|. | 25 // Launches the app_shell app in |app_location|. |
| 23 void LaunchApp(const std::string& app_location); | 26 void LaunchApp(const std::string& app_location); |
| 24 | 27 |
| 25 // Runs the test |test_name| in |app_location|. RunTest will launch the app | 28 // Runs the test |test_name| in |app_location|. RunTest will launch the app |
| 26 // and execute the javascript function runTest(test_name) inside the app. | 29 // and execute the javascript function runTest(test_name) inside the app. |
| 27 void RunTest(const std::string& test_name, const std::string& app_location); | 30 void RunTest(const std::string& test_name, const std::string& app_location); |
| 28 | 31 |
| 29 // Starts/Stops the embedded test server. | 32 // Starts/Stops the embedded test server. |
| 30 void StartTestServer(); | 33 void StartTestServer(); |
| 31 void StopTestServer(); | 34 void StopTestServer(); |
| 32 | 35 |
| 33 content::WebContents* GetEmbedderWebContents(); | 36 content::WebContents* GetEmbedderWebContents(); |
| 34 | 37 |
| 35 // Returns the GuestViewManager singleton. | 38 // Returns the GuestViewManager singleton. |
| 36 TestGuestViewManager* GetGuestViewManager(); | 39 guestview::TestGuestViewManager* GetGuestViewManager(); |
| 37 | 40 |
| 38 content::WebContents* GetGuestWebContents(); | 41 content::WebContents* GetGuestWebContents(); |
| 39 void SendMessageToGuestAndWait(const std::string& message, | 42 void SendMessageToGuestAndWait(const std::string& message, |
| 40 const std::string& wait_message); | 43 const std::string& wait_message); |
| 41 void SendMessageToEmbedder(const std::string& message); | 44 void SendMessageToEmbedder(const std::string& message); |
| 42 | 45 |
| 43 // content::BrowserTestBase implementation. | 46 // content::BrowserTestBase implementation. |
| 44 void RunTestOnMainThreadLoop() override; | 47 void RunTestOnMainThreadLoop() override; |
| 45 void SetUpCommandLine(base::CommandLine* command_line) override; | 48 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 46 void SetUpOnMainThread() override; | 49 void SetUpOnMainThread() override; |
| 47 void TearDownOnMainThread() override; | 50 void TearDownOnMainThread() override; |
| 48 | 51 |
| 49 content::WebContents* embedder_web_contents_; | 52 content::WebContents* embedder_web_contents_; |
| 50 TestGuestViewManagerFactory factory_; | 53 guestview::TestGuestViewManagerFactory factory_; |
| 51 base::DictionaryValue test_config_; | 54 base::DictionaryValue test_config_; |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 content::WebContents* GetFirstAppWindowWebContents(); | 57 content::WebContents* GetFirstAppWindowWebContents(); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 class WebViewDPIAPITest : public WebViewAPITest { | 60 class WebViewDPIAPITest : public WebViewAPITest { |
| 58 protected: | 61 protected: |
| 59 void SetUp() override; | 62 void SetUp() override; |
| 60 static float scale() { return 2.0f; } | 63 static float scale() { return 2.0f; } |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 } // namespace extensions | 66 } // namespace extensions |
| OLD | NEW |