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 "extensions/browser/guest_view/test_guest_view_manager.h"
7 #include "extensions/shell/test/shell_test.h"
8 #include "ui/gfx/switches.h"
12 } // namespace content
14 namespace extensions
{
15 class TestGuestViewManager
;
17 // Base class for WebView tests in app_shell.
18 class WebViewAPITest
: public AppShellTest
{
22 // Launches the app_shell app in |app_location|.
23 void LaunchApp(const std::string
& app_location
);
25 // 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.
27 void RunTest(const std::string
& test_name
, const std::string
& app_location
);
29 // Starts/Stops the embedded test server.
30 void StartTestServer();
31 void StopTestServer();
33 content::WebContents
* GetEmbedderWebContents();
35 // Returns the GuestViewManager singleton.
36 TestGuestViewManager
* GetGuestViewManager();
38 content::WebContents
* GetGuestWebContents();
39 void SendMessageToGuestAndWait(const std::string
& message
,
40 const std::string
& wait_message
);
41 void SendMessageToEmbedder(const std::string
& message
);
43 // content::BrowserTestBase implementation.
44 void RunTestOnMainThreadLoop() override
;
45 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
46 void SetUpOnMainThread() override
;
47 void TearDownOnMainThread() override
;
49 content::WebContents
* embedder_web_contents_
;
50 TestGuestViewManagerFactory factory_
;
51 base::DictionaryValue test_config_
;
54 content::WebContents
* GetFirstAppWindowWebContents();
57 class WebViewDPIAPITest
: public WebViewAPITest
{
59 void SetUp() override
;
60 static float scale() { return 2.0f
; }
63 } // namespace extensions