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
3 // found in the LICENSE file.
5 #include "base/values.h"
6 #include "components/guest_view/browser/test_guest_view_manager.h"
7 #include "extensions/shell/test/shell_test.h"
8 #include "ui/gfx/switches.h"
12 } // namespace content
15 class TestGuestViewManager
;
16 } // namesapce guestview
18 namespace extensions
{
20 // Base class for WebView tests in app_shell.
21 class WebViewAPITest
: public AppShellTest
{
25 // Launches the app_shell app in |app_location|.
26 void LaunchApp(const std::string
& app_location
);
28 // Runs the test |test_name| in |app_location|. RunTest will launch the app
29 // and execute the javascript function runTest(test_name) inside the app.
30 void RunTest(const std::string
& test_name
, const std::string
& app_location
);
32 // Starts/Stops the embedded test server.
33 void StartTestServer();
34 void StopTestServer();
36 content::WebContents
* GetEmbedderWebContents();
38 // Returns the GuestViewManager singleton.
39 guest_view::TestGuestViewManager
* GetGuestViewManager();
41 content::WebContents
* GetGuestWebContents();
42 void SendMessageToGuestAndWait(const std::string
& message
,
43 const std::string
& wait_message
);
44 void SendMessageToEmbedder(const std::string
& message
);
46 // content::BrowserTestBase implementation.
47 void RunTestOnMainThreadLoop() override
;
48 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
49 void SetUpOnMainThread() override
;
50 void TearDownOnMainThread() override
;
52 content::WebContents
* embedder_web_contents_
;
53 guest_view::TestGuestViewManagerFactory factory_
;
54 base::DictionaryValue test_config_
;
57 content::WebContents
* GetFirstAppWindowWebContents();
60 class WebViewDPIAPITest
: public WebViewAPITest
{
62 void SetUp() override
;
63 static float scale() { return 2.0f
; }
66 } // namespace extensions