Chromium Code Reviews| Index: chrome/browser/ui/webui/web_ui_browsertest.h |
| diff --git a/chrome/browser/ui/webui/web_ui_browsertest.h b/chrome/browser/ui/webui/web_ui_browsertest.h |
| index 91f136d697028f67ac353a72cc1d52ca3107c7ad..2c35f105999e7591ec64fdf135e6fccfbe56099f 100644 |
| --- a/chrome/browser/ui/webui/web_ui_browsertest.h |
| +++ b/chrome/browser/ui/webui/web_ui_browsertest.h |
| @@ -11,6 +11,7 @@ |
| #include "base/file_path.h" |
| #include "chrome/browser/ui/webui/web_ui_test_handler.h" |
| #include "chrome/test/in_process_browser_test.h" |
| +#include "chrome/test/test_navigation_observer.h" |
| class Value; |
| class WebUIMessageHandler; |
| @@ -29,7 +30,8 @@ class WebUIMessageHandler; |
| // These tests should follow the form given in: |
| // chrome/test/data/webui/sample_downloads.js. |
| // and the lone test within this class. |
| -class WebUIBrowserTest : public InProcessBrowserTest { |
| +class WebUIBrowserTest : public InProcessBrowserTest, |
| + public TestNavigationObserver::LoadStartObserver { |
| public: |
| typedef std::vector<const Value*> ConstValueVector; |
| virtual ~WebUIBrowserTest(); |
| @@ -50,6 +52,10 @@ class WebUIBrowserTest : public InProcessBrowserTest { |
| bool RunJavascriptFunction(const std::string& function_name, |
| const ConstValueVector& function_arguments); |
| + // Runs a test fixture that may include calls to functions in test_api.js. |
| + bool RunJavascriptTestF(const std::string& test_fixture, |
| + const std::string& test_name); |
| + |
| // Runs a test that may include calls to functions in test_api.js. |
| bool RunJavascriptTest(const std::string& test_name); |
| bool RunJavascriptTest(const std::string& test_name, |
| @@ -64,7 +70,24 @@ class WebUIBrowserTest : public InProcessBrowserTest { |
| // to prevent re-loading at next javascript invocation. If |
| // |override_chrome_send| is true, then chrome.send is overridden for |
| // javascript to register handlers. |
| - void PreLoadJavascriptLibraries(bool override_chrome_send); |
| + void PreLoadJavascriptLibraries(const std::string& preload_test_fixture, |
| + const std::string& preload_test_name); |
| + |
| + // Called by javascript-generated test bodies to browse to a page and preload |
| + // the javascript for the given |preload_test_fixture| and |
| + // |preload_test_name|. chrome.send will be overridden to allow javascript |
| + // handler mocking. |
| + void BrowsePreload(const GURL& browse_to, |
| + const std::string& preload_test_fixture, |
| + const std::string& preload_test_name); |
| + |
| + // Called by javascript-generated test bodies to browse to a page and preload |
| + // the javascript for the given |preload_test_fixture| and |
| + // |preload_test_name|. chrome.send will be overridden to allow javascript |
| + // handler mocking. |
| + void BrowsePrintPreload(const GURL& browse_to, |
| + const std::string& preload_test_fixture, |
| + const std::string& preload_test_name); |
| protected: |
| WebUIBrowserTest(); |
| @@ -75,14 +98,19 @@ class WebUIBrowserTest : public InProcessBrowserTest { |
| // Returns a mock WebUI object under test (if any). |
| virtual WebUIMessageHandler* GetMockMessageHandler(); |
| - // Skip this test with |skip_test_message|. |
| - void skipTest(const std::string& skip_test_message); |
| - |
| // Returns a file:// GURL constructed from |path| inside the test data dir for |
| // webui tests. |
| static GURL WebUITestDataPathToURL(const FilePath::StringType& path); |
| + // Saves the states of |test_fixture| and |test_name| for calling |
| + // PreloadJavascriptLibraries(). |
| + std::string preload_test_fixture_; |
|
sky
2011/07/11 20:50:22
style guide says no public/protected fields.
Sheridan Rawlins
2011/07/11 22:22:41
Done.
|
| + std::string preload_test_name_; |
| + |
| private: |
| + // TestNavigationObserver::LoadStartObserver implementation. |
| + virtual void OnLoadStart() OVERRIDE; |
| + |
| // Builds a string containing all added javascript libraries. |
| void BuildJavascriptLibraries(std::string* content); |
| @@ -113,9 +141,6 @@ class WebUIBrowserTest : public InProcessBrowserTest { |
| // Indicates that the libraries have been pre-loaded and to not load them |
| // again. |
| bool libraries_preloaded_; |
| - |
| - bool skip_test_; |
| - std::string skip_test_message_; |
| }; |
| #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ |