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 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_
8 #include "base/files/file_path.h"
9 #include "chrome/test/base/in_process_browser_test.h"
22 // See the .cc for default values.
23 struct VirtualKeyboardBrowserTestConfig
{
24 VirtualKeyboardBrowserTestConfig();
26 ~VirtualKeyboardBrowserTestConfig();
28 // The filename of the base framework. This file should be in |test_dir_|.
29 std::string base_framework_
;
31 // The virtual keyboard's extension id.
32 std::string extension_id_
;
34 // Path to the test directory.
35 std::string test_dir_
;
37 // URL of the keyboard extension.
41 class VirtualKeyboardBrowserTest
: public InProcessBrowserTest
{
43 // Injects javascript in |file| into the keyboard page and runs the methods in
44 // |file| whose names match the expression "test*".
45 void RunTest(const base::FilePath
& file
,
46 const VirtualKeyboardBrowserTestConfig
& config
);
48 void ShowVirtualKeyboard();
50 // Returns the render view host that the keyboard with extension |id| is in.
51 content::RenderViewHost
* GetKeyboardRenderViewHost(const std::string
& id
);
53 // InProcessBrowserTest.
54 // Ensure that the virtual keyboard is enabled.
55 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
58 // Accumulates the javascript and injects it when the test starts. The test
59 // |file| is in directory |dir| relative to the root testing directory.
60 void InjectJavascript(const base::FilePath
& dir
, const base::FilePath
& file
);
63 std::string utf8_content_
;
66 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_