Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: components/test_runner/test_runner.h

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: clean diff Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "media/midi/midi_service.mojom.h" 21 #include "media/midi/midi_service.mojom.h"
22 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" 22 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
23 #include "third_party/WebKit/public/platform/WebImage.h" 23 #include "third_party/WebKit/public/platform/WebImage.h"
24 #include "third_party/WebKit/public/platform/WebURL.h"
24 #include "v8/include/v8.h" 25 #include "v8/include/v8.h"
25 26
26 class GURL; 27 class GURL;
27 class SkBitmap; 28 class SkBitmap;
28 29
29 namespace base { 30 namespace base {
30 class NullableString16; 31 class NullableString16;
31 } 32 }
32 33
33 namespace blink { 34 namespace blink {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void SetDelegate(WebTestDelegate*); 81 void SetDelegate(WebTestDelegate*);
81 void SetMainView(blink::WebView*); 82 void SetMainView(blink::WebView*);
82 83
83 void Reset(); 84 void Reset();
84 85
85 void SetTestIsRunning(bool); 86 void SetTestIsRunning(bool);
86 bool TestIsRunning() const { return test_is_running_; } 87 bool TestIsRunning() const { return test_is_running_; }
87 88
88 bool UseMockTheme() const { return use_mock_theme_; } 89 bool UseMockTheme() const { return use_mock_theme_; }
89 90
91 // By default, tests end when page load is complete. These methods are used
92 // to delay the completion of the test until notifyDone is called.
93 void NotifyDone();
94 void WaitUntilDone();
95
90 // WebTestRunner implementation. 96 // WebTestRunner implementation.
91 bool ShouldGeneratePixelResults() override; 97 bool ShouldGeneratePixelResults() override;
92 bool ShouldDumpAsAudio() const override; 98 bool ShouldDumpAsAudio() const override;
93 void GetAudioData(std::vector<unsigned char>* buffer_view) const override; 99 void GetAudioData(std::vector<unsigned char>* buffer_view) const override;
94 bool IsRecursiveLayoutDumpRequested() override; 100 bool IsRecursiveLayoutDumpRequested() override;
95 std::string DumpLayout(blink::WebLocalFrame* frame) override; 101 std::string DumpLayout(blink::WebLocalFrame* frame) override;
96 void DumpPixelsAsync( 102 void DumpPixelsAsync(
97 blink::WebView* web_view, 103 blink::WebView* web_view,
98 const base::Callback<void(const SkBitmap&)>& callback) override; 104 const base::Callback<void(const SkBitmap&)>& callback) override;
99 void ReplicateLayoutTestRuntimeFlagsChanges( 105 void ReplicateLayoutTestRuntimeFlagsChanges(
(...skipping 13 matching lines...) Expand all
113 bool shouldStayOnPageAfterHandlingBeforeUnload() const; 119 bool shouldStayOnPageAfterHandlingBeforeUnload() const;
114 MockScreenOrientationClient* getMockScreenOrientationClient(); 120 MockScreenOrientationClient* getMockScreenOrientationClient();
115 MockWebUserMediaClient* getMockWebUserMediaClient(); 121 MockWebUserMediaClient* getMockWebUserMediaClient();
116 MockWebSpeechRecognizer* getMockWebSpeechRecognizer(); 122 MockWebSpeechRecognizer* getMockWebSpeechRecognizer();
117 bool isPrinting() const; 123 bool isPrinting() const;
118 bool shouldDumpAsCustomText() const; 124 bool shouldDumpAsCustomText() const;
119 std:: string customDumpText() const; 125 std:: string customDumpText() const;
120 void ShowDevTools(const std::string& settings, 126 void ShowDevTools(const std::string& settings,
121 const std::string& frontend_url); 127 const std::string& frontend_url);
122 void ClearDevToolsLocalStorage(); 128 void ClearDevToolsLocalStorage();
129 void LoadURLForMainFrame(const blink::WebURL& url);
123 void setShouldDumpAsText(bool); 130 void setShouldDumpAsText(bool);
124 void setShouldDumpAsMarkup(bool); 131 void setShouldDumpAsMarkup(bool);
125 void setCustomTextOutput(const std::string& text); 132 void setCustomTextOutput(const std::string& text);
126 void setShouldGeneratePixelResults(bool); 133 void setShouldGeneratePixelResults(bool);
127 void setShouldDumpFrameLoadCallbacks(bool); 134 void setShouldDumpFrameLoadCallbacks(bool);
128 void setShouldEnableViewSource(bool); 135 void setShouldEnableViewSource(bool);
129 bool shouldDumpEditingCallbacks() const; 136 bool shouldDumpEditingCallbacks() const;
130 bool shouldDumpFrameLoadCallbacks() const; 137 bool shouldDumpFrameLoadCallbacks() const;
131 bool shouldDumpPingLoaderCallbacks() const; 138 bool shouldDumpPingLoaderCallbacks() const;
132 bool shouldDumpUserGestureInFrameLoadCallbacks() const; 139 bool shouldDumpUserGestureInFrameLoadCallbacks() const;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 std::deque<WorkItem*> queue_; 221 std::deque<WorkItem*> queue_;
215 bool frozen_; 222 bool frozen_;
216 TestRunner* controller_; 223 TestRunner* controller_;
217 224
218 base::WeakPtrFactory<WorkQueue> weak_factory_; 225 base::WeakPtrFactory<WorkQueue> weak_factory_;
219 }; 226 };
220 227
221 /////////////////////////////////////////////////////////////////////////// 228 ///////////////////////////////////////////////////////////////////////////
222 // Methods dealing with the test logic 229 // Methods dealing with the test logic
223 230
224 // By default, tests end when page load is complete. These methods are used
225 // to delay the completion of the test until notifyDone is called.
226 void NotifyDone();
227 void WaitUntilDone();
228
229 // Methods for adding actions to the work queue. Used in conjunction with 231 // Methods for adding actions to the work queue. Used in conjunction with
230 // waitUntilDone/notifyDone above. 232 // waitUntilDone/notifyDone above.
231 void QueueBackNavigation(int how_far_back); 233 void QueueBackNavigation(int how_far_back);
232 void QueueForwardNavigation(int how_far_forward); 234 void QueueForwardNavigation(int how_far_forward);
233 void QueueReload(); 235 void QueueReload();
234 void QueueLoadingScript(const std::string& script); 236 void QueueLoadingScript(const std::string& script);
235 void QueueNonLoadingScript(const std::string& script); 237 void QueueNonLoadingScript(const std::string& script);
236 void QueueLoad(const std::string& url, const std::string& target); 238 void QueueLoad(const std::string& url, const std::string& target);
237 239
238 // Causes navigation actions just printout the intended navigation instead 240 // Causes navigation actions just printout the intended navigation instead
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 blink::WebEffectiveConnectionType effective_connection_type_; 669 blink::WebEffectiveConnectionType effective_connection_type_;
668 670
669 base::WeakPtrFactory<TestRunner> weak_factory_; 671 base::WeakPtrFactory<TestRunner> weak_factory_;
670 672
671 DISALLOW_COPY_AND_ASSIGN(TestRunner); 673 DISALLOW_COPY_AND_ASSIGN(TestRunner);
672 }; 674 };
673 675
674 } // namespace test_runner 676 } // namespace test_runner
675 677
676 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ 678 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698