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

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

Issue 2707183003: Move //components/test_runner back into //content/shell (Closed)
Patch Set: Trim DEPS Created 3 years, 10 months 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_
6 #define COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_
7
8 #include <string>
9
10 #include "base/logging.h"
11 #include "base/macros.h"
12 #include "base/values.h"
13 #include "components/test_runner/test_runner_export.h"
14 #include "components/test_runner/tracked_dictionary.h"
15
16 namespace test_runner {
17
18 // LayoutTestRuntimeFlags stores flags controlled by layout tests at runtime
19 // (i.e. by calling testRunner.dumpAsText() or testRunner.waitUntilDone()).
20 // Changes to the flags are tracked (to help replicate them across renderers).
21 class TEST_RUNNER_EXPORT LayoutTestRuntimeFlags {
22 public:
23 // Creates default flags (see also the Reset method).
24 LayoutTestRuntimeFlags();
25
26 // Resets all the values to their defaults.
27 void Reset();
28
29 TrackedDictionary& tracked_dictionary() { return dict_; }
30
31 #define DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(name) \
32 bool name() const { \
33 bool result; \
34 bool found = dict_.current_values().GetBoolean(#name, &result); \
35 DCHECK(found); \
36 return result; \
37 } \
38 void set_##name(bool new_value) { dict_.SetBoolean(#name, new_value); }
39
40 #define DEFINE_STRING_LAYOUT_TEST_RUNTIME_FLAG(name) \
41 std::string name() const { \
42 std::string result; \
43 bool found = dict_.current_values().GetString(#name, &result); \
44 DCHECK(found); \
45 return result; \
46 } \
47 void set_##name(const std::string& new_value) { \
48 dict_.SetString(#name, new_value); \
49 }
50
51 // If true, the test_shell will generate pixel results in DumpAsText mode.
52 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(generate_pixel_results)
53
54 // If true, the test_shell will produce a plain text dump rather than a
55 // text representation of the renderer.
56 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_as_text)
57
58 // If true and if dump_as_text_ is true, the test_shell will recursively
59 // dump all frames as plain text.
60 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_child_frames_as_text)
61
62 // If true, the test_shell will produce a dump of the DOM rather than a text
63 // representation of the renderer.
64 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_as_markup)
65
66 // If true and if dump_as_markup_ is true, the test_shell will recursively
67 // produce a dump of the DOM rather than a text representation of the
68 // renderer.
69 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_child_frames_as_markup)
70
71 // If true, the test_shell will print out the child frame scroll offsets as
72 // well.
73 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_child_frame_scroll_positions)
74
75 // If true, layout is to target printed pages.
76 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(is_printing)
77
78 // If true, don't dump output until notifyDone is called.
79 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(wait_until_done)
80
81 // If true, ends the test when a URL is loaded externally via
82 // WebFrameClient::loadURLExternally().
83 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(wait_until_external_url_load)
84
85 // Causes navigation actions just printout the intended navigation instead
86 // of taking you to the page. This is used for cases like mailto, where you
87 // don't actually want to open the mail program.
88 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(policy_delegate_enabled)
89
90 // Toggles the behavior of the policy delegate. If true, then navigations
91 // will be allowed. Otherwise, they will be ignored (dropped).
92 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(policy_delegate_is_permissive)
93
94 // If true, the policy delegate will signal layout test completion.
95 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(policy_delegate_should_notify_done)
96
97 // If true, the test_shell will draw the bounds of the current selection rect
98 // taking possible transforms of the selection rect into account.
99 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_selection_rect)
100
101 // If true, the test_shell will dump the drag image as pixel results.
102 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_drag_image)
103
104 // Contents of Accept-Language HTTP header requested by the test.
105 DEFINE_STRING_LAYOUT_TEST_RUNTIME_FLAG(accept_languages)
106
107 // Flags influencing behavior of MockContentSettingsClient.
108 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(images_allowed)
109 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(scripts_allowed)
110 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(storage_allowed)
111 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(plugins_allowed)
112 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(running_insecure_content_allowed)
113 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(
114 dump_web_content_settings_client_callbacks)
115 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(autoplay_allowed)
116
117 // If true, the test_shell will write a descriptive line for each editing
118 // command.
119 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_editting_callbacks)
120
121 // If true, the test_shell will output a descriptive line for each frame
122 // load callback.
123 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_frame_load_callbacks)
124
125 // If true, the test_shell will output a descriptive line for each
126 // PingLoader dispatched.
127 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_ping_loader_callbacks)
128
129 // If true, the test_shell will output a line of the user gesture status
130 // text for some frame load callbacks.
131 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(
132 dump_user_gesture_in_frame_load_callbacks)
133
134 // If true, the test_shell will output a descriptive line for each resource
135 // load callback.
136 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_resource_load_callbacks)
137
138 // If true, the test_shell will output the MIME type for each resource that
139 // was loaded.
140 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_resource_response_mime_types)
141
142 // If true, content_shell will dump the default navigation policy passed to
143 // WebFrameClient::decidePolicyForNavigation.
144 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_navigation_policy)
145
146 // If true, output a message when the page title is changed.
147 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_title_changes)
148
149 // If true, the test_shell will print out the icon change notifications.
150 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_icon_changes)
151
152 // If true, the console messages produced by the page will
153 // be part of test output.
154 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_console_messages)
155
156 // Desired return value of WebFrameClient::runModalBeforeUnloadDialog.
157 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(
158 stay_on_page_after_handling_before_unload)
159
160 // Indicates if the test already tracks a top loading frame (in any of the
161 // renderer processes). This flag is trying to prevent different renderer
162 // processes from tracking different top loading frames (i.e. main frame in
163 // one renderer and an OOPIF in another renderer).
164 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(have_top_loading_frame)
165
166 // If true, new windows can be opened via javascript or by plugins. By
167 // default, set to false and can be toggled to true using
168 // setCanOpenWindows().
169 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(can_open_windows)
170
171 // If true, output a descriptive line each time WebViewClient::createView
172 // is invoked.
173 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_create_view)
174
175 // If true, the test_shell will dump all changes to window.status.
176 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_window_status_changes)
177
178 // If true, the test_shell will output descriptive test for spellcheck
179 // execution.
180 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_spell_check_callbacks)
181
182 // If true, content_shell will output text for alert(), confirm(), prompt(),
183 // etc.
184 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_javascript_dialogs)
185
186 // True if the test called testRunner.setCustomTextOutput.
187 DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(has_custom_text_output)
188
189 // Contains text passed by the test to testRunner.setCustomTextOutput.
190 DEFINE_STRING_LAYOUT_TEST_RUNTIME_FLAG(custom_text_output)
191
192 #undef DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG
193 #undef DEFINE_STRING_LAYOUT_TEST_RUNTIME_FLAG
194
195 // Reports whether recursing over child frames is necessary.
196 bool dump_child_frames() const {
197 if (dump_as_text())
198 return dump_child_frames_as_text();
199 else if (dump_as_markup())
200 return dump_child_frames_as_markup();
201 else
202 return dump_child_frame_scroll_positions();
203 }
204
205 private:
206 TrackedDictionary dict_;
207
208 DISALLOW_COPY_AND_ASSIGN(LayoutTestRuntimeFlags);
209 };
210
211 } // namespace test_runner
212
213 #endif // COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698