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