1 // Copyright 2018 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 CHROME_BROWSER_PLUGINS_PLUGIN_TEST_UTILS_H_
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_TEST_UTILS_H_
7 
8 #include <string>
9 
10 #include "base/macros.h"
11 #include "base/strings/string_piece.h"
12 
13 namespace content {
14 class WebContents;
15 }
16 
17 class PluginTestUtils {
18  public:
19   // Runs the JavaScript |test_script|, which is provided 'plugin' as a variable
20   // referencing the |element_id| element. Returns the string extracted from
21   // window.domAutomationController.
22   static std::string RunTestScript(base::StringPiece test_script,
23                                    content::WebContents* contents,
24                                    const std::string& element_id);
25 
26   // Blocks until the placeholder is ready.
27   static void WaitForPlaceholderReady(content::WebContents* contents,
28                                       const std::string& element_id);
29 
30  private:
31   DISALLOW_IMPLICIT_CONSTRUCTORS(PluginTestUtils);
32 };
33 
34 #endif  // CHROME_BROWSER_PLUGINS_PLUGIN_TEST_UTILS_H_
35