Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3728)

Unified Diff: chrome/test/base/extension_js_browser_test.h

Issue 320753002: Support javascript gtests in an extension background page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lint Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/base/extension_js_browser_test.h
diff --git a/chrome/test/base/extension_js_browser_test.h b/chrome/test/base/extension_js_browser_test.h
new file mode 100644
index 0000000000000000000000000000000000000000..c9e0118703eb4a45d05beb8b5192aa2e0fa59d4b
--- /dev/null
+++ b/chrome/test/base/extension_js_browser_test.h
@@ -0,0 +1,39 @@
+// 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_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_
+#define CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_
+
+#include "base/callback_forward.h"
+#include "chrome/test/base/extension_load_waiter_one_shot.h"
+#include "chrome/test/base/javascript_browser_test.h"
+
+// A super class that handles javascript-based tests against an extension.
+//
+// See an example usage at
+//chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.extjs
+class ExtensionJSBrowserTest : public JavaScriptBrowserTest {
+ public:
+ ExtensionJSBrowserTest() : libs_loaded_(false) {}
+
+ virtual ~ExtensionJSBrowserTest() {}
+
+ protected:
+ // Waits for an extension to load; returns immediately if already loaded.
+ void WaitForExtension(const char* extension_id, const base::Closure& load_cb);
+
+ // Method required for js2gtest.
+ // Runs |test_fixture|.|test_name| using the framework in test_api.js.
+ bool RunJavascriptTestF(bool is_async,
+ const std::string& test_fixture,
+ const std::string& test_name);
+
+ private:
+ scoped_ptr<ExtensionLoadWaiterOneShot> load_waiter_;
+ bool libs_loaded_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionJSBrowserTest);
+};
+
+#endif // CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_

Powered by Google App Engine
This is Rietveld 408576698