| 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_DOM_UI_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_DOM_UI_DOM_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/dom_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 DOMMessageHandler; |
| 16 |
| 15 // The runner of DOMUI javascript based tests. | 17 // The runner of DOMUI javascript based tests. |
| 16 // 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. |
| 17 // | 19 // |
| 18 // These tests should follow the form given in: | 20 // These tests should follow the form given in: |
| 19 // chrome/test/data/dom_ui/sample_downloads.js. | 21 // chrome/test/data/dom_ui/sample_downloads.js. |
| 20 // and the lone test within this class. | 22 // and the lone test within this class. |
| 21 class DOMUITest : public InProcessBrowserTest { | 23 class DOMUITest : public InProcessBrowserTest { |
| 22 public: | 24 public: |
| 23 bool RunDOMUITest(const FilePath::CharType* src_path); | 25 bool RunDOMUITest(const FilePath::CharType* src_path); |
| 24 | 26 |
| 25 protected: | 27 protected: |
| 26 DOMUITest(); | 28 DOMUITest(); |
| 27 | 29 |
| 30 // Setup test path. |
| 28 virtual void SetUpInProcessBrowserTestFixture(); | 31 virtual void SetUpInProcessBrowserTestFixture(); |
| 29 | 32 |
| 33 // Returns a mock DOMUI object under test (if any). |
| 34 virtual DOMMessageHandler* GetMockMessageHandler() { return NULL; } |
| 35 |
| 30 private: | 36 private: |
| 31 // Builds a javascript test in the form: | 37 // Builds a javascript test in the form: |
| 32 // <js_library> ... | 38 // <js_library> ... |
| 33 // <src_path> ... | 39 // <src_path> ... |
| 34 // runTests(function test1() {...}, | 40 // runTests(function test1() {...}, |
| 35 // ... | 41 // ... |
| 36 // ); | 42 // ); |
| 37 void BuildJavaScriptTest(const FilePath& src_path, | 43 void BuildJavaScriptTest(const FilePath& src_path, |
| 38 std::string* content); | 44 std::string* content); |
| 39 | 45 |
| 46 // Attaches mock and test handlers. |
| 47 void SetupHandlers(); |
| 48 |
| 40 // Handles test framework messages. | 49 // Handles test framework messages. |
| 41 scoped_ptr<DOMUITestHandler> handler_; | 50 scoped_ptr<DOMUITestHandler> test_handler_; |
| 42 | 51 |
| 43 // Location of test data (currently test/data/dom_ui). | 52 // Location of test data (currently test/data/dom_ui). |
| 44 FilePath test_data_directory_; | 53 FilePath test_data_directory_; |
| 45 }; | 54 }; |
| 46 | 55 |
| 47 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_BROWSERTEST_H_ | 56 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_BROWSERTEST_H_ |
| OLD | NEW |