| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/webui/web_ui_browsertest.h" | 4 #include "chrome/browser/ui/webui/web_ui_browsertest.h" |
| 5 | 5 |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 14 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" | 15 #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" |
| 15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 17 #include "chrome/test/ui_test_utils.h" | 18 #include "chrome/test/ui_test_utils.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/browser/webui/web_ui.h" | |
| 20 #include "testing/gtest/include/gtest/gtest-spi.h" | 20 #include "testing/gtest/include/gtest/gtest-spi.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js"); | 25 const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js"); |
| 26 const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui"); | 26 const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui"); |
| 27 base::LazyInstance<std::vector<std::string> > error_messages_( | 27 base::LazyInstance<std::vector<std::string> > error_messages_( |
| 28 base::LINKER_INITIALIZED); | 28 base::LINKER_INITIALIZED); |
| 29 | 29 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // below. WebUIBrowserTest requires being on a page which is a WebUI page. Using | 286 // below. WebUIBrowserTest requires being on a page which is a WebUI page. Using |
| 287 // the TestChromeWebUIFactory, we use a dummy URL |kChromeTestBrowserTestPass|, | 287 // the TestChromeWebUIFactory, we use a dummy URL |kChromeTestBrowserTestPass|, |
| 288 // which we force to be a WebUI page. | 288 // which we force to be a WebUI page. |
| 289 class WebUIBrowserTestPass | 289 class WebUIBrowserTestPass |
| 290 : public WebUIBrowserTest, | 290 : public WebUIBrowserTest, |
| 291 public TestChromeWebUIFactory::WebUIProvider { | 291 public TestChromeWebUIFactory::WebUIProvider { |
| 292 private: | 292 private: |
| 293 // TestChromeWebUIFactory::WebUIProvider: | 293 // TestChromeWebUIFactory::WebUIProvider: |
| 294 virtual WebUI* NewWebUI(TabContents* tab_contents, | 294 virtual WebUI* NewWebUI(TabContents* tab_contents, |
| 295 const GURL& url) OVERRIDE { | 295 const GURL& url) OVERRIDE { |
| 296 return new WebUI(tab_contents); | 296 return new ChromeWebUI(tab_contents); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // InProcessBrowserTest: | 299 // InProcessBrowserTest: |
| 300 virtual void SetUpOnMainThread() OVERRIDE { | 300 virtual void SetUpOnMainThread() OVERRIDE { |
| 301 WebUIBrowserTest::SetUpOnMainThread(); | 301 WebUIBrowserTest::SetUpOnMainThread(); |
| 302 ui_test_utils::NavigateToURL(browser(), | 302 ui_test_utils::NavigateToURL(browser(), |
| 303 GURL(kChromeTestBrowserTestPass)); | 303 GURL(kChromeTestBrowserTestPass)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 306 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 317 | 317 |
| 318 static const char kChromeTestBrowserTestPass[]; | 318 static const char kChromeTestBrowserTestPass[]; |
| 319 }; | 319 }; |
| 320 | 320 |
| 321 const char WebUIBrowserTestPass::kChromeTestBrowserTestPass[] = | 321 const char WebUIBrowserTestPass::kChromeTestBrowserTestPass[] = |
| 322 "chrome://WebUIBrowserTestPass"; | 322 "chrome://WebUIBrowserTestPass"; |
| 323 | 323 |
| 324 #include "chrome/test/data/webui/sample_pass-inl.h" | 324 #include "chrome/test/data/webui/sample_pass-inl.h" |
| 325 | 325 |
| 326 #endif // !defined(ARCH_CPU_ARM_FAMILY) | 326 #endif // !defined(ARCH_CPU_ARM_FAMILY) |
| OLD | NEW |