File: layout_test_runtime_flags.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (207 lines) | stat: -rw-r--r-- 8,797 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_
#define COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_

#include <string>

#include "base/logging.h"
#include "base/macros.h"
#include "base/values.h"
#include "components/test_runner/test_runner_export.h"
#include "components/test_runner/tracked_dictionary.h"

namespace test_runner {

// LayoutTestRuntimeFlags stores flags controlled by layout tests at runtime
// (i.e. by calling testRunner.dumpAsText() or testRunner.waitUntilDone()).
// Changes to the flags are tracked (to help replicate them across renderers).
class TEST_RUNNER_EXPORT LayoutTestRuntimeFlags {
 public:
  // Creates default flags (see also the Reset method).
  LayoutTestRuntimeFlags();

  // Resets all the values to their defaults.
  void Reset();

  TrackedDictionary& tracked_dictionary() { return dict_; }

#define DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(name)                  \
  bool name() const {                                               \
    bool result;                                                    \
    bool found = dict_.current_values().GetBoolean(#name, &result); \
    DCHECK(found);                                                  \
    return result;                                                  \
  }                                                                 \
  void set_##name(bool new_value) { dict_.SetBoolean(#name, new_value); }

#define DEFINE_STRING_LAYOUT_TEST_RUNTIME_FLAG(name)               \
  std::string name() const {                                       \
    std::string result;                                            \
    bool found = dict_.current_values().GetString(#name, &result); \
    DCHECK(found);                                                 \
    return result;                                                 \
  }                                                                \
  void set_##name(const std::string& new_value) {                  \
    dict_.SetString(#name, new_value);                             \
  }

  // If true, the test_shell will generate pixel results in DumpAsText mode.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(generate_pixel_results)

  // If true, the test_shell will produce a plain text dump rather than a
  // text representation of the renderer.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_as_text)

  // If true and if dump_as_text_ is true, the test_shell will recursively
  // dump all frames as plain text.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_child_frames_as_text)

  // If true, the test_shell will produce a dump of the DOM rather than a text
  // representation of the renderer.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_as_markup)

  // If true and if dump_as_markup_ is true, the test_shell will recursively
  // produce a dump of the DOM rather than a text representation of the
  // renderer.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_child_frames_as_markup)

  // If true, the test_shell will print out the child frame scroll offsets as
  // well.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_child_frame_scroll_positions)

  // If true, layout is to target printed pages.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(is_printing)

  // If true, don't dump output until notifyDone is called.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(wait_until_done)

  // If true, ends the test when a URL is loaded externally via
  // WebFrameClient::loadURLExternally().
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(wait_until_external_url_load)

  // Causes navigation actions just printout the intended navigation instead
  // of taking you to the page. This is used for cases like mailto, where you
  // don't actually want to open the mail program.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(policy_delegate_enabled)

  // Toggles the behavior of the policy delegate. If true, then navigations
  // will be allowed. Otherwise, they will be ignored (dropped).
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(policy_delegate_is_permissive)

  // If true, the policy delegate will signal layout test completion.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(policy_delegate_should_notify_done)

  // If true, the test_shell will draw the bounds of the current selection rect
  // taking possible transforms of the selection rect into account.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_selection_rect)

  // If true, the test_shell will dump the drag image as pixel results.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_drag_image)

  // Contents of Accept-Language HTTP header requested by the test.
  DEFINE_STRING_LAYOUT_TEST_RUNTIME_FLAG(accept_languages)

  // Flags influencing behavior of MockContentSettingsClient.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(images_allowed)
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(scripts_allowed)
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(storage_allowed)
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(plugins_allowed)
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(running_insecure_content_allowed)
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(
      dump_web_content_settings_client_callbacks)
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(autoplay_allowed)

  // If true, the test_shell will write a descriptive line for each editing
  // command.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_editting_callbacks)

  // If true, the test_shell will output a descriptive line for each frame
  // load callback.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_frame_load_callbacks)

  // If true, the test_shell will output a descriptive line for each
  // PingLoader dispatched.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_ping_loader_callbacks)

  // If true, the test_shell will output a line of the user gesture status
  // text for some frame load callbacks.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(
      dump_user_gesture_in_frame_load_callbacks)

  // If true, the test_shell will output a descriptive line for each resource
  // load callback.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_resource_load_callbacks)

  // If true, the test_shell will output the MIME type for each resource that
  // was loaded.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_resource_response_mime_types)

  // If true, content_shell will dump the default navigation policy passed to
  // WebFrameClient::decidePolicyForNavigation.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_navigation_policy)

  // If true, output a message when the page title is changed.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_title_changes)

  // If true, the test_shell will print out the icon change notifications.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_icon_changes)

  // If true, the console messages produced by the page will
  // be part of test output.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_console_messages)

  // Desired return value of WebFrameClient::runModalBeforeUnloadDialog.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(
      stay_on_page_after_handling_before_unload)

  // Indicates if the test already tracks a top loading frame (in any of the
  // renderer processes).  This flag is trying to prevent different renderer
  // processes from tracking different top loading frames (i.e. main frame in
  // one renderer and an OOPIF in another renderer).
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(have_top_loading_frame)

  // If true, new windows can be opened via javascript or by plugins. By
  // default, set to false and can be toggled to true using
  // setCanOpenWindows().
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(can_open_windows)

  // If true, output a descriptive line each time WebViewClient::createView
  // is invoked.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_create_view)

  // If true, the test_shell will dump all changes to window.status.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_window_status_changes)

  // If true, the test_shell will output descriptive test for spellcheck
  // execution.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_spell_check_callbacks)

  // If true, content_shell will output text for alert(), confirm(), prompt(),
  // etc.
  DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_javascript_dialogs)

#undef DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG
#undef DEFINE_STRING_LAYOUT_TEST_RUNTIME_FLAG

  // Reports whether recursing over child frames is necessary.
  bool dump_child_frames() const {
    if (dump_as_text())
      return dump_child_frames_as_text();
    else if (dump_as_markup())
      return dump_child_frames_as_markup();
    else
      return dump_child_frame_scroll_positions();
  }

 private:
  TrackedDictionary dict_;

  DISALLOW_COPY_AND_ASSIGN(LayoutTestRuntimeFlags);
};

}  // namespace test_runner

#endif  // COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_