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_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_
6 #define CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_
8 #include "base/callback_forward.h"
9 #include "chrome/test/base/extension_load_waiter_one_shot.h"
10 #include "chrome/test/base/javascript_browser_test.h"
12 // A super class that handles javascript-based tests against an extension.
14 // See an example usage at
15 //chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.extjs
16 class ExtensionJSBrowserTest
: public JavaScriptBrowserTest
{
18 ExtensionJSBrowserTest();
20 virtual ~ExtensionJSBrowserTest();
23 // Waits for an extension to load; returns immediately if already loaded.
24 void WaitForExtension(const char* extension_id
, const base::Closure
& load_cb
);
26 // Method required for js2gtest.
27 // Runs |test_fixture|.|test_name| using the framework in test_api.js.
28 bool RunJavascriptTestF(bool is_async
,
29 const std::string
& test_fixture
,
30 const std::string
& test_name
);
33 scoped_ptr
<ExtensionLoadWaiterOneShot
> load_waiter_
;
36 DISALLOW_COPY_AND_ASSIGN(ExtensionJSBrowserTest
);
39 #endif // CHROME_TEST_BASE_EXTENSION_JS_BROWSER_TEST_H_