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

Unified Diff: components/test_runner/test_runner.cc

Issue 1689283003: Remove duplication between TestRunner's fields and LayoutDumpFlags struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/test_runner/test_runner.cc
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index f09284ca54e29c24e54b9130444664ba11df2b55..a96ebfcf2f15b75c368c1f0f86e7fa478b651b5e 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -1736,12 +1736,14 @@ void TestRunner::Reset() {
}
dump_editting_callbacks_ = false;
- dump_as_text_ = false;
- dump_as_markup_ = false;
+ layout_dump_flags_.dump_as_text = false;
+ layout_dump_flags_.dump_as_markup = false;
generate_pixel_results_ = true;
- dump_child_frame_scroll_positions_ = false;
- dump_child_frames_as_markup_ = false;
- dump_child_frames_as_text_ = false;
+ layout_dump_flags_.dump_child_frame_scroll_positions = false;
+ layout_dump_flags_.dump_child_frames_as_markup = false;
+ layout_dump_flags_.dump_child_frames_as_text = false;
+ layout_dump_flags_.dump_line_box_trees = false;
+ layout_dump_flags_.debug_render_tree = false;
dump_icon_changes_ = false;
dump_as_audio_ = false;
dump_frame_load_callbacks_ = false;
@@ -1761,7 +1763,7 @@ void TestRunner::Reset() {
dump_navigation_policy_ = false;
test_repaint_ = false;
sweep_horizontally_ = false;
- is_printing_ = false;
+ layout_dump_flags_.is_printing = false;
midi_accessor_result_ = true;
should_stay_on_page_after_handling_before_unload_ = false;
should_dump_resource_priorities_ = false;
@@ -1804,21 +1806,12 @@ bool TestRunner::shouldDumpEditingCallbacks() const {
return dump_editting_callbacks_;
}
-bool TestRunner::shouldDumpAsText() {
- CheckResponseMimeType();
- return dump_as_text_;
-}
-
void TestRunner::setShouldDumpAsText(bool value) {
- dump_as_text_ = value;
-}
-
-bool TestRunner::shouldDumpAsMarkup() {
- return dump_as_markup_;
+ layout_dump_flags_.dump_as_text = value;
}
void TestRunner::setShouldDumpAsMarkup(bool value) {
- dump_as_markup_ = value;
+ layout_dump_flags_.dump_as_markup = value;
}
bool TestRunner::shouldDumpAsCustomText() const {
@@ -1848,18 +1841,6 @@ void TestRunner::setShouldGeneratePixelResults(bool value) {
generate_pixel_results_ = value;
}
-bool TestRunner::shouldDumpChildFrameScrollPositions() const {
- return dump_child_frame_scroll_positions_;
-}
-
-bool TestRunner::shouldDumpChildFramesAsMarkup() const {
- return dump_child_frames_as_markup_;
-}
-
-bool TestRunner::shouldDumpChildFramesAsText() const {
- return dump_child_frames_as_text_;
-}
-
bool TestRunner::ShouldDumpAsAudio() const {
return dump_as_audio_;
}
@@ -1868,25 +1849,9 @@ void TestRunner::GetAudioData(std::vector<unsigned char>* buffer_view) const {
*buffer_view = audio_data_;
}
-LayoutDumpFlags TestRunner::GetLayoutDumpFlags() {
- LayoutDumpFlags result;
-
- if (shouldDumpAsText()) {
- result.main_dump_mode = LayoutDumpMode::DUMP_AS_TEXT;
- result.dump_child_frames = shouldDumpChildFramesAsText();
- } else if (shouldDumpAsMarkup()) {
- result.main_dump_mode = LayoutDumpMode::DUMP_AS_MARKUP;
- result.dump_child_frames = shouldDumpChildFramesAsMarkup();
- } else {
- result.main_dump_mode = LayoutDumpMode::DUMP_SCROLL_POSITIONS;
- result.dump_child_frames = shouldDumpChildFrameScrollPositions();
- }
-
- result.dump_as_printed = isPrinting();
-
- result.dump_line_box_trees = result.debug_render_tree = false;
-
- return result;
+const LayoutDumpFlags& TestRunner::GetLayoutDumpFlags() {
+ CheckResponseMimeType();
dcheng 2016/02/23 18:26:35 Why is this line here?
Łukasz Anforowicz 2016/02/23 18:45:26 Previously this call was made by shouldDumpAsText
+ return layout_dump_flags_;
}
bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const {
@@ -1971,7 +1936,7 @@ bool TestRunner::shouldDumpSelectionRect() const {
}
bool TestRunner::isPrinting() const {
- return is_printing_;
+ return layout_dump_flags_.is_printing;
}
bool TestRunner::shouldWaitUntilExternalURLLoad() const {
@@ -2690,30 +2655,30 @@ void TestRunner::DumpEditingCallbacks() {
}
void TestRunner::DumpAsMarkup() {
- dump_as_markup_ = true;
+ layout_dump_flags_.dump_as_markup = true;
generate_pixel_results_ = false;
}
void TestRunner::DumpAsText() {
- dump_as_text_ = true;
+ layout_dump_flags_.dump_as_text = true;
generate_pixel_results_ = false;
}
void TestRunner::DumpAsTextWithPixelResults() {
- dump_as_text_ = true;
+ layout_dump_flags_.dump_as_text = true;
generate_pixel_results_ = true;
}
void TestRunner::DumpChildFrameScrollPositions() {
- dump_child_frame_scroll_positions_ = true;
+ layout_dump_flags_.dump_child_frame_scroll_positions = true;
}
void TestRunner::DumpChildFramesAsMarkup() {
- dump_child_frames_as_markup_ = true;
+ layout_dump_flags_.dump_child_frames_as_markup = true;
}
void TestRunner::DumpChildFramesAsText() {
- dump_child_frames_as_text_ = true;
+ layout_dump_flags_.dump_child_frames_as_text = true;
}
void TestRunner::DumpIconChanges() {
@@ -2812,11 +2777,11 @@ void TestRunner::DumpSelectionRect() {
}
void TestRunner::SetPrinting() {
- is_printing_ = true;
+ layout_dump_flags_.is_printing = true;
}
void TestRunner::ClearPrinting() {
- is_printing_ = false;
+ layout_dump_flags_.is_printing = false;
}
void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) {
@@ -3194,11 +3159,11 @@ void TestRunner::LocationChangeDone() {
void TestRunner::CheckResponseMimeType() {
// Text output: the test page can request different types of output which we
// handle here.
- if (!dump_as_text_) {
+ if (!layout_dump_flags_.dump_as_text) {
std::string mimeType =
web_view_->mainFrame()->dataSource()->response().mimeType().utf8();
if (mimeType == "text/plain") {
- dump_as_text_ = true;
+ layout_dump_flags_.dump_as_text = true;
generate_pixel_results_ = false;
}
}

Powered by Google App Engine
This is Rietveld 408576698