| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_ |
| 6 #define CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_ | 6 #define CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "chrome/test/base/extension_load_waiter_one_shot.h" | 9 #include "chrome/test/base/extension_load_waiter_one_shot.h" |
| 10 #include "chrome/test/base/javascript_browser_test.h" | 10 #include "chrome/test/base/javascript_browser_test.h" |
| 11 | 11 |
| 12 // A super class that handles javascript-based tests against an extension. | 12 // A super class that handles javascript-based tests against an extension. |
| 13 // | 13 // |
| 14 // See an example usage at | 14 // See an example usage at |
| 15 //chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.extjs | 15 //chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.extjs |
| 16 class ExtensionJSBrowserTest : public JavaScriptBrowserTest { | 16 class ExtensionJSBrowserTest : public JavaScriptBrowserTest { |
| 17 public: | 17 public: |
| 18 ExtensionJSBrowserTest(); | 18 ExtensionJSBrowserTest(); |
| 19 | 19 |
| 20 ~ExtensionJSBrowserTest() override; | 20 virtual ~ExtensionJSBrowserTest(); |
| 21 | 21 |
| 22 protected: | 22 protected: |
| 23 // Waits for an extension to load; returns immediately if already loaded. | 23 // Waits for an extension to load; returns immediately if already loaded. |
| 24 void WaitForExtension(const char* extension_id, const base::Closure& load_cb); | 24 void WaitForExtension(const char* extension_id, const base::Closure& load_cb); |
| 25 | 25 |
| 26 // Method required for js2gtest. | 26 // Method required for js2gtest. |
| 27 // Runs |test_fixture|.|test_name| using the framework in test_api.js. | 27 // Runs |test_fixture|.|test_name| using the framework in test_api.js. |
| 28 bool RunJavascriptTestF(bool is_async, | 28 bool RunJavascriptTestF(bool is_async, |
| 29 const std::string& test_fixture, | 29 const std::string& test_fixture, |
| 30 const std::string& test_name); | 30 const std::string& test_name); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 scoped_ptr<ExtensionLoadWaiterOneShot> load_waiter_; | 33 scoped_ptr<ExtensionLoadWaiterOneShot> load_waiter_; |
| 34 bool libs_loaded_; | 34 bool libs_loaded_; |
| 35 | 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(ExtensionJSBrowserTest); | 36 DISALLOW_COPY_AND_ASSIGN(ExtensionJSBrowserTest); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 #endif // CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_ | 39 #endif // CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_ |
| OLD | NEW |