OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ |
6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class DictionaryValue; | 12 class DictionaryValue; |
13 } | 13 } |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 class WebContentSettingsClient; | 16 class WebContentSettingsClient; |
| 17 class WebLocalFrame; |
17 } | 18 } |
18 | 19 |
19 namespace test_runner { | 20 namespace test_runner { |
20 | 21 |
21 class LayoutDumpFlags; | |
22 | |
23 class WebTestRunner { | 22 class WebTestRunner { |
24 public: | 23 public: |
25 // Returns a mock WebContentSettings that is used for layout tests. An | 24 // Returns a mock WebContentSettings that is used for layout tests. An |
26 // embedder should use this for all WebViews it creates. | 25 // embedder should use this for all WebViews it creates. |
27 virtual blink::WebContentSettingsClient* GetWebContentSettings() const = 0; | 26 virtual blink::WebContentSettingsClient* GetWebContentSettings() const = 0; |
28 | 27 |
29 // After WebTestDelegate::TestFinished was invoked, the following methods | 28 // After WebTestDelegate::TestFinished was invoked, the following methods |
30 // can be used to determine what kind of dump the main WebTestProxy can | 29 // can be used to determine what kind of dump the main WebTestProxy can |
31 // provide. | 30 // provide. |
32 | 31 |
33 // If true, WebTestDelegate::audioData returns an audio dump and no text | 32 // If true, WebTestDelegate::audioData returns an audio dump and no text |
34 // or pixel results are available. | 33 // or pixel results are available. |
35 virtual bool ShouldDumpAsAudio() const = 0; | 34 virtual bool ShouldDumpAsAudio() const = 0; |
36 virtual void GetAudioData(std::vector<unsigned char>* buffer_view) const = 0; | 35 virtual void GetAudioData(std::vector<unsigned char>* buffer_view) const = 0; |
37 | 36 |
38 // Gets layout dump flags (i.e. dump-as-text or dump-as-markup) requested | 37 // Reports if tests requested a recursive layout dump of all frames |
39 // by the test (i.e. via testRunner.dumpAsText() called from javascript). | 38 // (i.e. by calling testRunner.dumpChildFramesAsText() from javascript). |
40 virtual const LayoutDumpFlags& GetLayoutDumpFlags() = 0; | 39 virtual bool IsRecursiveLayoutDumpRequested() = 0; |
41 | 40 |
42 // Replicates changes to layout dump flags. | 41 // Dumps layout of |frame| using the mode requested by the current test |
| 42 // (i.e. text mode if testRunner.dumpAsText() was called from javascript). |
| 43 virtual std::string DumpLayout(blink::WebLocalFrame* frame) = 0; |
| 44 |
| 45 // Replicates changes to layout dump flags (i.e. changes that happened in |
| 46 // another renderer). See also WebTestDelegate::OnLayoutDumpFlagsChanged. |
43 virtual void ReplicateLayoutDumpFlagsChanges( | 47 virtual void ReplicateLayoutDumpFlagsChanges( |
44 const base::DictionaryValue& changed_values) = 0; | 48 const base::DictionaryValue& changed_values) = 0; |
45 | 49 |
46 // If custom text dump is present (i.e. if testRunner.setCustomTextOutput has | 50 // If custom text dump is present (i.e. if testRunner.setCustomTextOutput has |
47 // been called from javascript), then returns |true| and populates the | 51 // been called from javascript), then returns |true| and populates the |
48 // |custom_text_dump| argument. Otherwise returns |false|. | 52 // |custom_text_dump| argument. Otherwise returns |false|. |
49 virtual bool HasCustomTextDump(std::string* custom_text_dump) const = 0; | 53 virtual bool HasCustomTextDump(std::string* custom_text_dump) const = 0; |
50 | 54 |
51 // Returns true if the call to WebTestProxy::captureTree will invoke | 55 // Returns true if the call to WebTestProxy::captureTree will invoke |
52 // WebTestDelegate::captureHistoryForWindow. | 56 // WebTestDelegate::captureHistoryForWindow. |
53 virtual bool ShouldDumpBackForwardList() const = 0; | 57 virtual bool ShouldDumpBackForwardList() const = 0; |
54 | 58 |
55 // Returns true if WebTestProxy::capturePixels should be invoked after | 59 // Returns true if WebTestProxy::capturePixels should be invoked after |
56 // capturing text results. | 60 // capturing text results. |
57 virtual bool ShouldGeneratePixelResults() = 0; | 61 virtual bool ShouldGeneratePixelResults() = 0; |
58 }; | 62 }; |
59 | 63 |
60 } // namespace test_runner | 64 } // namespace test_runner |
61 | 65 |
62 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ | 66 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_RUNNER_H_ |
OLD | NEW |