| 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 | 4 |
| 5 #ifndef CHROME_BROWSER_DOM_UI_DOM_UI_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_WEB_UI_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_DOM_UI_WEB_UI_BROWSERTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "chrome/browser/dom_ui/dom_ui_handler_browsertest.h" | 12 #include "chrome/browser/dom_ui/web_ui_handler_browsertest.h" |
| 13 #include "chrome/test/in_process_browser_test.h" | 13 #include "chrome/test/in_process_browser_test.h" |
| 14 | 14 |
| 15 class WebUIMessageHandler; | 15 class WebUIMessageHandler; |
| 16 | 16 |
| 17 // The runner of WebUI javascript based tests. | 17 // The runner of WebUI javascript based tests. |
| 18 // See chrome/test/data/dom_ui/test_api.js for the javascript side test API's. | 18 // See chrome/test/data/dom_ui/test_api.js for the javascript side test API's. |
| 19 // | 19 // |
| 20 // These tests should follow the form given in: | 20 // These tests should follow the form given in: |
| 21 // chrome/test/data/dom_ui/sample_downloads.js. | 21 // chrome/test/data/dom_ui/sample_downloads.js. |
| 22 // and the lone test within this class. | 22 // and the lone test within this class. |
| 23 class DOMUITest : public InProcessBrowserTest { | 23 class WebUIBrowserTest : public InProcessBrowserTest { |
| 24 public: | 24 public: |
| 25 virtual ~DOMUITest(); | 25 virtual ~WebUIBrowserTest(); |
| 26 | 26 |
| 27 bool RunDOMUITest(const FilePath::CharType* src_path); | 27 bool RunWebUITest(const FilePath::CharType* src_path); |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 DOMUITest(); | 30 WebUIBrowserTest(); |
| 31 | 31 |
| 32 // Setup test path. | 32 // Setup test path. |
| 33 virtual void SetUpInProcessBrowserTestFixture(); | 33 virtual void SetUpInProcessBrowserTestFixture(); |
| 34 | 34 |
| 35 // Returns a mock WebUI object under test (if any). | 35 // Returns a mock WebUI object under test (if any). |
| 36 virtual WebUIMessageHandler* GetMockMessageHandler() { return NULL; } | 36 virtual WebUIMessageHandler* GetMockMessageHandler() { return NULL; } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // Builds a javascript test in the form: | 39 // Builds a javascript test in the form: |
| 40 // <js_library> ... | 40 // <js_library> ... |
| 41 // <src_path> ... | 41 // <src_path> ... |
| 42 // runTests(function test1() {...}, | 42 // runTests(function test1() {...}, |
| 43 // ... | 43 // ... |
| 44 // ); | 44 // ); |
| 45 void BuildJavaScriptTest(const FilePath& src_path, | 45 void BuildJavaScriptTest(const FilePath& src_path, |
| 46 std::string* content); | 46 std::string* content); |
| 47 | 47 |
| 48 // Attaches mock and test handlers. | 48 // Attaches mock and test handlers. |
| 49 void SetupHandlers(); | 49 void SetupHandlers(); |
| 50 | 50 |
| 51 // Handles test framework messages. | 51 // Handles test framework messages. |
| 52 scoped_ptr<DOMUITestHandler> test_handler_; | 52 scoped_ptr<WebUIHandlerBrowserTest> test_handler_; |
| 53 | 53 |
| 54 // Location of test data (currently test/data/dom_ui). | 54 // Location of test data (currently test/data/dom_ui). |
| 55 FilePath test_data_directory_; | 55 FilePath test_data_directory_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_BROWSERTEST_H_ | 58 #endif // CHROME_BROWSER_DOM_UI_WEB_UI_BROWSERTEST_H_ |
| OLD | NEW |