OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ | |
6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback_forward.h" | |
12 | |
13 class SkBitmap; | |
14 | |
15 namespace base { | |
16 class DictionaryValue; | |
17 } | |
18 | |
19 namespace blink { | |
20 class WebContentSettingsClient; | |
21 class WebLocalFrame; | |
22 class WebView; | |
23 } | |
24 | |
25 namespace test_runner { | |
26 | |
27 class WebTestRunner { | |
28 public: | |
29 // Returns a mock WebContentSettings that is used for layout tests. An | |
30 // embedder should use this for all WebViews it creates. | |
31 virtual blink::WebContentSettingsClient* GetWebContentSettings() const = 0; | |
32 | |
33 // After WebTestDelegate::TestFinished was invoked, the following methods | |
34 // can be used to determine what kind of dump the main WebViewTestProxy can | |
35 // provide. | |
36 | |
37 // If true, WebTestDelegate::audioData returns an audio dump and no text | |
38 // or pixel results are available. | |
39 virtual bool ShouldDumpAsAudio() const = 0; | |
40 virtual void GetAudioData(std::vector<unsigned char>* buffer_view) const = 0; | |
41 | |
42 // Reports if tests requested a recursive layout dump of all frames | |
43 // (i.e. by calling testRunner.dumpChildFramesAsText() from javascript). | |
44 virtual bool IsRecursiveLayoutDumpRequested() = 0; | |
45 | |
46 // Dumps layout of |frame| using the mode requested by the current test | |
47 // (i.e. text mode if testRunner.dumpAsText() was called from javascript). | |
48 virtual std::string DumpLayout(blink::WebLocalFrame* frame) = 0; | |
49 | |
50 // Snapshots image of |web_view| using the mode requested by the current test | |
51 // and calls |callback| with the result. Caller needs to ensure that | |
52 // |web_view| stays alive until |callback| is called. | |
53 virtual void DumpPixelsAsync( | |
54 blink::WebView* web_view, | |
55 const base::Callback<void(const SkBitmap&)>& callback) = 0; | |
56 | |
57 // Replicates changes to layout test runtime flags | |
58 // (i.e. changes that happened in another renderer). | |
59 // See also WebTestDelegate::OnLayoutTestRuntimeFlagsChanged. | |
60 virtual void ReplicateLayoutTestRuntimeFlagsChanges( | |
61 const base::DictionaryValue& changed_values) = 0; | |
62 | |
63 // If custom text dump is present (i.e. if testRunner.setCustomTextOutput has | |
64 // been called from javascript), then returns |true| and populates the | |
65 // |custom_text_dump| argument. Otherwise returns |false|. | |
66 virtual bool HasCustomTextDump(std::string* custom_text_dump) const = 0; | |
67 | |
68 // Returns true if the call to WebViewTestProxy::captureTree will invoke | |
69 // WebTestDelegate::captureHistoryForWindow. | |
70 virtual bool ShouldDumpBackForwardList() const = 0; | |
71 | |
72 // Returns true if WebViewTestProxy::capturePixels should be invoked after | |
73 // capturing text results. | |
74 virtual bool ShouldGeneratePixelResults() = 0; | |
75 | |
76 // Sets various interfaces consumed by WebView to implementations providing | |
77 // test behavior. This method covers interfaces that are not exposed via | |
78 // WebViewClient (and are covered by WebViewTestClient) - for example this | |
79 // method covers blink::WebCredentialManagerClient and | |
80 // blink::WebSpellCheckClient. | |
81 virtual void InitializeWebViewWithMocks(blink::WebView* web_view) = 0; | |
82 | |
83 // Sets focus on the given view. Internally tracks currently focused view, | |
84 // to aid in defocusing previously focused views at the right time. | |
85 virtual void SetFocus(blink::WebView* web_view, bool focus) = 0; | |
86 }; | |
87 | |
88 } // namespace test_runner | |
89 | |
90 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ | |
OLD | NEW |