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