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

Unified Diff: chrome/browser/ui/webui/web_ui_browsertest.cc

Issue 7087014: Support automatic javascript test registry in gtest when creating WebUI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the include of the generated dir to the condition for ! 'arm'. Created 9 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
« no previous file with comments | « chrome/browser/ui/webui/javascript2webui.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/web_ui_browsertest.cc
diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc
index 65cdea1a0b6e7a592547c78411a5102ca855a0c5..89d7e0ab57705851817954a1f013ef395363d351 100644
--- a/chrome/browser/ui/webui/web_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/web_ui_browsertest.cc
@@ -11,6 +11,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/ui_test_utils.h"
@@ -21,9 +22,8 @@
namespace {
-const FilePath::StringType kWebUILibraryJS =
- FILE_PATH_LITERAL("test_api.js");
-const FilePath::StringType kWebUITestFolder = FILE_PATH_LITERAL("webui");
+const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js");
+const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui");
base::LazyInstance<std::vector<std::string> > error_messages_(
base::LINKER_INITIALIZED);
@@ -278,3 +278,49 @@ IN_PROC_BROWSER_TEST_F(WebUIBrowserExpectFailTest, TestFailsFast) {
EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"),
"WebUITestHandler::Observe");
}
+
+
+// crbug.com/88104 - v8_shell#host doesn't build when host=="arm".
+#if !defined(ARCH_CPU_ARM_FAMILY)
+// This test framework is used in the generated tests, which are included
+// below. WebUIBrowserTest requires being on a page which is a WebUI page. Using
+// the TestChromeWebUIFactory, we use a dummy URL |kChromeTestBrowserTestPass|,
+// which we force to be a WebUI page.
+class WebUIBrowserTestPass
+ : public WebUIBrowserTest,
+ public TestChromeWebUIFactory::WebUIProvider {
+ private:
+ // TestChromeWebUIFactory::WebUIProvider:
+ virtual WebUI* NewWebUI(TabContents* tab_contents,
+ const GURL& url) OVERRIDE {
+ return new WebUI(tab_contents);
+ }
+
+ // InProcessBrowserTest:
+ virtual void SetUpOnMainThread() OVERRIDE {
+ WebUIBrowserTest::SetUpOnMainThread();
+ ui_test_utils::NavigateToURL(browser(),
+ GURL(kChromeTestBrowserTestPass));
+ }
+
+ virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
+ WebUIBrowserTest::SetUpInProcessBrowserTestFixture();
+ TestChromeWebUIFactory::AddFactoryOverride(
+ GURL(kChromeTestBrowserTestPass).host(), this);
+ }
+
+ virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
+ WebUIBrowserTest::TearDownInProcessBrowserTestFixture();
+ TestChromeWebUIFactory::RemoveFactoryOverride(
+ GURL(kChromeTestBrowserTestPass).host());
+ }
+
+ static const char kChromeTestBrowserTestPass[];
+};
+
+const char WebUIBrowserTestPass::kChromeTestBrowserTestPass[] =
+ "chrome://WebUIBrowserTestPass";
+
+#include "chrome/test/data/webui/sample_pass-inl.h"
+
+#endif // !defined(ARCH_CPU_ARM_FAMILY)
« no previous file with comments | « chrome/browser/ui/webui/javascript2webui.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698