| 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_TEST_RUNNER_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ | 6 #define COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "components/test_runner/layout_test_runtime_flags.h" | 18 #include "components/test_runner/layout_test_runtime_flags.h" |
| 19 #include "components/test_runner/test_runner_export.h" | 19 #include "components/test_runner/test_runner_export.h" |
| 20 #include "components/test_runner/web_test_runner.h" | 20 #include "components/test_runner/web_test_runner.h" |
| 21 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" |
| 21 #include "third_party/WebKit/public/platform/WebImage.h" | 22 #include "third_party/WebKit/public/platform/WebImage.h" |
| 22 #include "v8/include/v8.h" | 23 #include "v8/include/v8.h" |
| 23 | 24 |
| 24 class GURL; | 25 class GURL; |
| 25 class SkBitmap; | 26 class SkBitmap; |
| 26 | 27 |
| 27 namespace blink { | 28 namespace blink { |
| 28 class WebContentSettingsClient; | 29 class WebContentSettingsClient; |
| 29 class WebFrame; | 30 class WebFrame; |
| 30 class WebLocalFrame; | 31 class WebLocalFrame; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 bool shouldDumpNavigationPolicy() const; | 162 bool shouldDumpNavigationPolicy() const; |
| 162 | 163 |
| 163 bool midiAccessorResult(); | 164 bool midiAccessorResult(); |
| 164 | 165 |
| 165 // Methods used by MockColorChooser: | 166 // Methods used by MockColorChooser: |
| 166 void DidOpenChooser(); | 167 void DidOpenChooser(); |
| 167 void DidCloseChooser(); | 168 void DidCloseChooser(); |
| 168 | 169 |
| 169 bool ShouldDumpConsoleMessages() const; | 170 bool ShouldDumpConsoleMessages() const; |
| 170 | 171 |
| 172 blink::WebEffectiveConnectionType effective_connection_type() const { |
| 173 return effective_connection_type_; |
| 174 } |
| 175 |
| 171 // A single item in the work queue. | 176 // A single item in the work queue. |
| 172 class WorkItem { | 177 class WorkItem { |
| 173 public: | 178 public: |
| 174 virtual ~WorkItem() {} | 179 virtual ~WorkItem() {} |
| 175 | 180 |
| 176 // Returns true if this started a load. | 181 // Returns true if this started a load. |
| 177 virtual bool Run(WebTestDelegate*, blink::WebView*) = 0; | 182 virtual bool Run(WebTestDelegate*, blink::WebView*) = 0; |
| 178 }; | 183 }; |
| 179 | 184 |
| 180 private: | 185 private: |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 void DumpDragImage(); | 460 void DumpDragImage(); |
| 456 | 461 |
| 457 // Sets a flag that tells the WebViewTestProxy to dump the default navigation | 462 // Sets a flag that tells the WebViewTestProxy to dump the default navigation |
| 458 // policy passed to the decidePolicyForNavigation callback. | 463 // policy passed to the decidePolicyForNavigation callback. |
| 459 void DumpNavigationPolicy(); | 464 void DumpNavigationPolicy(); |
| 460 | 465 |
| 461 // Controls whether console messages produced by the page are dumped | 466 // Controls whether console messages produced by the page are dumped |
| 462 // to test output. | 467 // to test output. |
| 463 void SetDumpConsoleMessages(bool value); | 468 void SetDumpConsoleMessages(bool value); |
| 464 | 469 |
| 470 // Overrides the NetworkQualityEstimator's estimated network type. If |type| |
| 471 // is TypeUnknown the NQE's value is used. Be sure to call this with |
| 472 // TypeUnknown at the end of your test if you use this. |
| 473 void SetEffectiveConnectionType( |
| 474 blink::WebEffectiveConnectionType connection_type); |
| 475 |
| 465 // Controls whether the mock spell checker is enabled. | 476 // Controls whether the mock spell checker is enabled. |
| 466 void SetMockSpellCheckerEnabled(bool enabled); | 477 void SetMockSpellCheckerEnabled(bool enabled); |
| 467 | 478 |
| 468 /////////////////////////////////////////////////////////////////////////// | 479 /////////////////////////////////////////////////////////////////////////// |
| 469 // Methods interacting with the WebViewTestProxy | 480 // Methods interacting with the WebViewTestProxy |
| 470 | 481 |
| 471 /////////////////////////////////////////////////////////////////////////// | 482 /////////////////////////////////////////////////////////////////////////// |
| 472 // Methods forwarding to the WebTestDelegate | 483 // Methods forwarding to the WebTestDelegate |
| 473 | 484 |
| 474 // Shows DevTools window. | 485 // Shows DevTools window. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // View that was focused by a previous call to TestRunner::SetFocus method. | 644 // View that was focused by a previous call to TestRunner::SetFocus method. |
| 634 // Note - this can be a dangling pointer to an already destroyed WebView (this | 645 // Note - this can be a dangling pointer to an already destroyed WebView (this |
| 635 // is ok, because this is taken care of in WebTestDelegate::SetFocus). | 646 // is ok, because this is taken care of in WebTestDelegate::SetFocus). |
| 636 blink::WebView* previously_focused_view_; | 647 blink::WebView* previously_focused_view_; |
| 637 | 648 |
| 638 std::set<blink::WebWidget*> widgets_with_scheduled_animations_; | 649 std::set<blink::WebWidget*> widgets_with_scheduled_animations_; |
| 639 | 650 |
| 640 // True if we run a test in LayoutTests/imported/{csswg-test,wpt}/. | 651 // True if we run a test in LayoutTests/imported/{csswg-test,wpt}/. |
| 641 bool is_web_platform_tests_mode_; | 652 bool is_web_platform_tests_mode_; |
| 642 | 653 |
| 654 // An effective connection type settable by layout tests. |
| 655 blink::WebEffectiveConnectionType effective_connection_type_; |
| 656 |
| 643 base::WeakPtrFactory<TestRunner> weak_factory_; | 657 base::WeakPtrFactory<TestRunner> weak_factory_; |
| 644 | 658 |
| 645 DISALLOW_COPY_AND_ASSIGN(TestRunner); | 659 DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 646 }; | 660 }; |
| 647 | 661 |
| 648 } // namespace test_runner | 662 } // namespace test_runner |
| 649 | 663 |
| 650 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ | 664 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| OLD | NEW |