OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_ | |
7 | |
8 #include "base/files/file_path.h" | |
9 #include "chrome/test/base/in_process_browser_test.h" | |
10 #include "url/gurl.h" | |
11 | |
12 namespace base { | |
13 class CommandLine; | |
14 class FilePath; | |
15 } | |
16 | |
17 namespace content { | |
18 class RenderViewHost; | |
19 class WebContents; | |
20 } | |
21 | |
22 class VirtualKeyboardBrowserTestHelper { | |
Jeffrey Yasskin
2014/05/02 22:09:37
"Helper" isn't a great suffix, especially for a cl
rsadam
2014/05/05 17:44:42
Done.
| |
23 public: | |
24 VirtualKeyboardBrowserTestHelper(); | |
25 | |
26 virtual ~VirtualKeyboardBrowserTestHelper(); | |
Jeffrey Yasskin
2014/05/02 22:09:37
Doesn't need to be virtual anymore.
rsadam
2014/05/05 17:44:42
Done.
| |
27 | |
28 void set_base_framework(std::string base_framework) { | |
29 base_framework_ = base_framework; | |
30 } | |
31 | |
32 void set_test_dir(std::string test_dir) { test_dir_ = test_dir; } | |
33 | |
34 void set_url(std::string url) { url_ = url; } | |
35 | |
36 void set_extension_id(std::string id) { extension_id_ = id; } | |
37 | |
38 const std::string base_framework() const { return base_framework_; } | |
39 | |
40 const std::string test_dir() const { return test_dir_; } | |
41 | |
42 const std::string url() const { return url_; } | |
43 | |
44 const std::string extension_id() const { return extension_id_; } | |
45 | |
46 private: | |
47 // The filename of the base framework. This file should be in |test_dir_|. | |
48 std::string base_framework_; | |
Jeffrey Yasskin
2014/05/02 22:09:37
It looks like this could just be a struct:
struct
rsadam
2014/05/05 17:44:42
Done.
| |
49 | |
50 // The virtual keyboard's extension id. | |
51 std::string extension_id_; | |
52 | |
53 // Path to the test directory. | |
54 std::string test_dir_; | |
55 | |
56 // URL of the keyboard extension. | |
57 std::string url_; | |
58 }; | |
59 | |
60 class VirtualKeyboardBrowserTest : public InProcessBrowserTest { | |
61 public: | |
62 // Injects javascript in |file| into the keyboard page and runs the methods in | |
63 // |file| whose names match the expression "test*". | |
64 void RunTest(const base::FilePath& file, | |
65 const VirtualKeyboardBrowserTestHelper& helper); | |
66 | |
67 void ShowVirtualKeyboard(); | |
68 | |
69 // Returns the render view host that the keyboard with extension |id| is in. | |
70 content::RenderViewHost* GetKeyboardRenderViewHost(std::string id); | |
71 | |
72 // InProcessBrowserTest. | |
73 // Ensure that the virtual keyboard is enabled. | |
74 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; | |
75 | |
76 protected: | |
77 // Accumulates the javascript and injects it when the test starts. The test | |
78 // |file| is in directory |dir| relative to the root testing directory. | |
79 void InjectJavascript(const base::FilePath& dir, const base::FilePath& file); | |
80 | |
81 private: | |
82 std::string utf8_content_; | |
83 }; | |
84 | |
85 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_ | |
OLD | NEW |