forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb_test_runner.h
More file actions
94 lines (72 loc) · 3.57 KB
/
web_test_runner.h
File metadata and controls
94 lines (72 loc) · 3.57 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2014 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 CONTENT_SHELL_TEST_RUNNER_WEB_TEST_RUNNER_H_
#define CONTENT_SHELL_TEST_RUNNER_WEB_TEST_RUNNER_H_
#include <string>
#include <vector>
#include "base/callback_forward.h"
class SkBitmap;
namespace base {
class DictionaryValue;
}
namespace blink {
class WebContentSettingsClient;
class WebLocalFrame;
class WebTextCheckClient;
class WebView;
}
namespace test_runner {
class WebTestRunner {
public:
// Returns a mock WebContentSettings that is used for web tests. An
// embedder should use this for all WebViews it creates.
virtual blink::WebContentSettingsClient* GetWebContentSettings() const = 0;
// Returns a mock WebTextCheckClient that is used for web tests. An
// embedder should use this for all WebLocalFrames it creates.
virtual blink::WebTextCheckClient* GetWebTextCheckClient() const = 0;
// After WebTestDelegate::TestFinished was invoked, the following methods
// can be used to determine what kind of dump the main WebViewTestProxy can
// provide.
// If true, WebTestDelegate::audioData returns an audio dump and no text
// or pixel results are available.
virtual bool ShouldDumpAsAudio() const = 0;
virtual void GetAudioData(std::vector<unsigned char>* buffer_view) const = 0;
// Reports if tests requested a recursive layout dump of all frames
// (i.e. by calling testRunner.dumpChildFramesAsText() from javascript).
virtual bool IsRecursiveLayoutDumpRequested() = 0;
// Dumps layout of |frame| using the mode requested by the current test
// (i.e. text mode if testRunner.dumpAsText() was called from javascript).
virtual std::string DumpLayout(blink::WebLocalFrame* frame) = 0;
// Returns true if the selection window should be painted onto captured
// pixels.
virtual bool ShouldDumpSelectionRect() const = 0;
// Snapshots image of |web_view| using the mode requested by the current test
// and calls |callback| with the result. Caller needs to ensure that
// |web_view| stays alive until |callback| is called.
// Returns false if the request to capture pixels was processed locally, and
// true if the pixels need to be captured in the browser process instead..
virtual bool DumpPixelsAsync(
blink::WebLocalFrame* frame,
base::OnceCallback<void(const SkBitmap&)> callback) = 0;
// Replicates changes to web test runtime flags
// (i.e. changes that happened in another renderer).
// See also WebTestDelegate::OnWebTestRuntimeFlagsChanged.
virtual void ReplicateWebTestRuntimeFlagsChanges(
const base::DictionaryValue& changed_values) = 0;
// If custom text dump is present (i.e. if testRunner.setCustomTextOutput has
// been called from javascript), then returns |true| and populates the
// |custom_text_dump| argument. Otherwise returns |false|.
virtual bool HasCustomTextDump(std::string* custom_text_dump) const = 0;
// Returns true if the call to WebViewTestProxy::captureTree will invoke
// WebTestDelegate::captureHistoryForWindow.
virtual bool ShouldDumpBackForwardList() const = 0;
// Returns true if WebViewTestProxy::capturePixels should be invoked after
// capturing text results.
virtual bool ShouldGeneratePixelResults() = 0;
// Sets focus on the given view. Internally tracks currently focused view,
// to aid in defocusing previously focused views at the right time.
virtual void SetFocus(blink::WebView* web_view, bool focus) = 0;
};
} // namespace test_runner
#endif // CONTENT_SHELL_TEST_RUNNER_WEB_TEST_RUNNER_H_