| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_LAYOUT_TEST_RUNTIME_FLAGS_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ | 6 #define COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/test_runner/test_runner_export.h" | 13 #include "components/test_runner/test_runner_export.h" |
| 14 #include "components/test_runner/tracked_dictionary.h" | 14 #include "components/test_runner/tracked_dictionary.h" |
| 15 | 15 |
| 16 namespace test_runner { | 16 namespace test_runner { |
| 17 | 17 |
| 18 // LayoutTestRuntimeFlags stores flags controlled by layout tests at runtime | 18 // LayoutTestRuntimeFlags stores flags controlled by layout tests at runtime |
| 19 // (i.e. by calling testRunner.dumpAsText() or testRunner.waitUntilDone()). | 19 // (i.e. by calling testRunner.dumpAsText() or testRunner.waitUntilDone()). |
| 20 // Changes to the flags are tracked (to help replicate them across renderers). | 20 // Changes to the flags are tracked (to help replicate them across renderers). |
| 21 class TEST_RUNNER_EXPORT LayoutTestRuntimeFlags { | 21 class TEST_RUNNER_EXPORT LayoutTestRuntimeFlags { |
| 22 public: | 22 public: |
| 23 // Creates default flags (see also the Reset method). | 23 // Creates default flags (see also the Reset method). |
| 24 LayoutTestRuntimeFlags(); | 24 LayoutTestRuntimeFlags(); |
| 25 | 25 |
| 26 // Resets all the values to their defaults. | 26 // Resets all the values to their defaults. |
| 27 void Reset(); | 27 void Reset(); |
| 28 | 28 |
| 29 TrackedDictionary& tracked_dictionary() { return dict_; } | 29 TrackedDictionary& tracked_dictionary() { return dict_; } |
| 30 const TrackedDictionary& tracked_dictionary() const { return dict_; } | |
| 31 | 30 |
| 32 #define DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(name) \ | 31 #define DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(name) \ |
| 33 bool name() const { \ | 32 bool name() const { \ |
| 34 bool result; \ | 33 bool result; \ |
| 35 bool found = dict_.current_values().GetBoolean(#name, &result); \ | 34 bool found = dict_.current_values().GetBoolean(#name, &result); \ |
| 36 DCHECK(found); \ | 35 DCHECK(found); \ |
| 37 return result; \ | 36 return result; \ |
| 38 } \ | 37 } \ |
| 39 void set_##name(bool new_value) { dict_.SetBoolean(#name, new_value); } | 38 void set_##name(bool new_value) { dict_.SetBoolean(#name, new_value); } |
| 40 | 39 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 115 |
| 117 private: | 116 private: |
| 118 TrackedDictionary dict_; | 117 TrackedDictionary dict_; |
| 119 | 118 |
| 120 DISALLOW_COPY_AND_ASSIGN(LayoutTestRuntimeFlags); | 119 DISALLOW_COPY_AND_ASSIGN(LayoutTestRuntimeFlags); |
| 121 }; | 120 }; |
| 122 | 121 |
| 123 } // namespace test_runner | 122 } // namespace test_runner |
| 124 | 123 |
| 125 #endif // COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ | 124 #endif // COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ |
| OLD | NEW |