Index: chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h |
diff --git a/chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h b/chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..aaf2ad3adc276f7ce1c1adc5a1b61b2e42e89e28 |
--- /dev/null |
+++ b/chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h |
@@ -0,0 +1,85 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_ |
+#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_ |
+ |
+#include "base/files/file_path.h" |
+#include "chrome/test/base/in_process_browser_test.h" |
+#include "url/gurl.h" |
+ |
+namespace base { |
+class CommandLine; |
+class FilePath; |
+} |
+ |
+namespace content { |
+class RenderViewHost; |
+class WebContents; |
+} |
+ |
+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.
|
+ public: |
+ VirtualKeyboardBrowserTestHelper(); |
+ |
+ 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.
|
+ |
+ void set_base_framework(std::string base_framework) { |
+ base_framework_ = base_framework; |
+ } |
+ |
+ void set_test_dir(std::string test_dir) { test_dir_ = test_dir; } |
+ |
+ void set_url(std::string url) { url_ = url; } |
+ |
+ void set_extension_id(std::string id) { extension_id_ = id; } |
+ |
+ const std::string base_framework() const { return base_framework_; } |
+ |
+ const std::string test_dir() const { return test_dir_; } |
+ |
+ const std::string url() const { return url_; } |
+ |
+ const std::string extension_id() const { return extension_id_; } |
+ |
+ private: |
+ // The filename of the base framework. This file should be in |test_dir_|. |
+ 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.
|
+ |
+ // The virtual keyboard's extension id. |
+ std::string extension_id_; |
+ |
+ // Path to the test directory. |
+ std::string test_dir_; |
+ |
+ // URL of the keyboard extension. |
+ std::string url_; |
+}; |
+ |
+class VirtualKeyboardBrowserTest : public InProcessBrowserTest { |
+ public: |
+ // Injects javascript in |file| into the keyboard page and runs the methods in |
+ // |file| whose names match the expression "test*". |
+ void RunTest(const base::FilePath& file, |
+ const VirtualKeyboardBrowserTestHelper& helper); |
+ |
+ void ShowVirtualKeyboard(); |
+ |
+ // Returns the render view host that the keyboard with extension |id| is in. |
+ content::RenderViewHost* GetKeyboardRenderViewHost(std::string id); |
+ |
+ // InProcessBrowserTest. |
+ // Ensure that the virtual keyboard is enabled. |
+ virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; |
+ |
+ protected: |
+ // Accumulates the javascript and injects it when the test starts. The test |
+ // |file| is in directory |dir| relative to the root testing directory. |
+ void InjectJavascript(const base::FilePath& dir, const base::FilePath& file); |
+ |
+ private: |
+ std::string utf8_content_; |
+}; |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_VIRTUAL_KEYBOARD_BROWSERTEST_H_ |