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