diff options
author | lukasza <lukasza@chromium.org> | 2016-03-24 09:51:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-24 16:52:48 +0000 |
commit | 083b4f1a4b0594bdb7cf4275ce6fa432ab8c1ad7 (patch) | |
tree | 198ab70c0f16dffa405f54299c9b1979cb3f5879 | |
parent | c991adfd9a653ed4d3c57af3736d16b2b21c9aa5 (diff) | |
download | chromium_src-083b4f1a4b0594bdb7cf4275ce6fa432ab8c1ad7.zip chromium_src-083b4f1a4b0594bdb7cf4275ce6fa432ab8c1ad7.tar.gz chromium_src-083b4f1a4b0594bdb7cf4275ce6fa432ab8c1ad7.tar.bz2 |
Rename LayoutDumpFlags to LayoutTestRuntimeFlags.
LayoutTestRuntimeFlags is meant to track all global (per-test) flags -
some of these flags are not related layout dumps. One example of such
layout-dump-independent runtime flag is wait_until_done which was added
recently in https://crrev.com/1715573002. Going forward we will be
moving other layout-dump-indepentent flags from TestRunner into
LayoutTestRuntimeFlags (i.e. dump_frame_load_callbacks,
policy_delegate_enabled, etc.).
BUG=587175
Review URL: https://codereview.chromium.org/1804703002
Cr-Commit-Position: refs/heads/master@{#383079}
18 files changed, 141 insertions, 127 deletions
diff --git a/components/test_runner/BUILD.gn b/components/test_runner/BUILD.gn index 2a7e2da..8bfbeb5 100644 --- a/components/test_runner/BUILD.gn +++ b/components/test_runner/BUILD.gn @@ -26,8 +26,8 @@ component("test_runner") { "gc_controller.h", "layout_dump.cc", "layout_dump.h", - "layout_dump_flags.cc", - "layout_dump_flags.h", + "layout_test_runtime_flags.cc", + "layout_test_runtime_flags.h", "mock_color_chooser.cc", "mock_color_chooser.h", "mock_credential_manager_client.cc", diff --git a/components/test_runner/layout_dump.cc b/components/test_runner/layout_dump.cc index bcd652b..05fd2b4 100644 --- a/components/test_runner/layout_dump.cc +++ b/components/test_runner/layout_dump.cc @@ -53,7 +53,8 @@ std::string DumpFrameScrollPosition(WebFrame* frame) { } // namespace -std::string DumpLayout(WebLocalFrame* frame, const LayoutDumpFlags& flags) { +std::string DumpLayout(WebLocalFrame* frame, + const LayoutTestRuntimeFlags& flags) { DCHECK(frame); std::string result; diff --git a/components/test_runner/layout_dump.h b/components/test_runner/layout_dump.h index 5582ee9..f80c9c6 100644 --- a/components/test_runner/layout_dump.h +++ b/components/test_runner/layout_dump.h @@ -7,7 +7,7 @@ #include <string> -#include "components/test_runner/layout_dump_flags.h" +#include "components/test_runner/layout_test_runtime_flags.h" #include "components/test_runner/test_runner_export.h" namespace blink { @@ -17,7 +17,7 @@ class WebLocalFrame; namespace test_runner { TEST_RUNNER_EXPORT std::string DumpLayout(blink::WebLocalFrame* frame, - const LayoutDumpFlags& flags); + const LayoutTestRuntimeFlags& flags); } // namespace test_runner diff --git a/components/test_runner/layout_dump_flags.cc b/components/test_runner/layout_test_runtime_flags.cc index 67f1f45..67ff6b3 100644 --- a/components/test_runner/layout_dump_flags.cc +++ b/components/test_runner/layout_test_runtime_flags.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/test_runner/layout_dump_flags.h" +#include "components/test_runner/layout_test_runtime_flags.h" namespace test_runner { -LayoutDumpFlags::LayoutDumpFlags() { +LayoutTestRuntimeFlags::LayoutTestRuntimeFlags() { Reset(); } -void LayoutDumpFlags::Reset() { +void LayoutTestRuntimeFlags::Reset() { set_generate_pixel_results(true); set_dump_as_text(false); diff --git a/components/test_runner/layout_dump_flags.h b/components/test_runner/layout_test_runtime_flags.h index b1de488..f3d1781 100644 --- a/components/test_runner/layout_dump_flags.h +++ b/components/test_runner/layout_test_runtime_flags.h @@ -2,8 +2,8 @@ // 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_DUMP_FLAGS_H_ -#define COMPONENTS_TEST_RUNNER_LAYOUT_DUMP_FLAGS_H_ +#ifndef COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ +#define COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ #include <string> @@ -15,11 +15,13 @@ namespace test_runner { -// TODO(lukasza): Rename to LayoutTestRuntimeFlags. -class TEST_RUNNER_EXPORT LayoutDumpFlags { +// 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). - LayoutDumpFlags(); + LayoutTestRuntimeFlags(); // Resets all the values to their defaults. void Reset(); @@ -27,7 +29,7 @@ class TEST_RUNNER_EXPORT LayoutDumpFlags { TrackedDictionary& tracked_dictionary() { return dict_; } const TrackedDictionary& tracked_dictionary() const { return dict_; } -#define DEFINE_BOOL_LAYOUT_DUMP_FLAG(name) \ +#define DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(name) \ bool name() const { \ bool result; \ bool found = dict_.current_values().GetBoolean(#name, &result); \ @@ -37,36 +39,36 @@ class TEST_RUNNER_EXPORT LayoutDumpFlags { void set_##name(bool new_value) { dict_.SetBoolean(#name, new_value); } // If true, the test_shell will generate pixel results in DumpAsText mode. - DEFINE_BOOL_LAYOUT_DUMP_FLAG(generate_pixel_results) + 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_DUMP_FLAG(dump_as_text) + 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_DUMP_FLAG(dump_child_frames_as_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_DUMP_FLAG(dump_as_markup) + 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_DUMP_FLAG(dump_child_frames_as_markup) + 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_DUMP_FLAG(dump_child_frame_scroll_positions) + DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(dump_child_frame_scroll_positions) // If true, layout is to target printed pages. - DEFINE_BOOL_LAYOUT_DUMP_FLAG(is_printing) + DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(is_printing) // If true, don't dump output until notifyDone is called. - DEFINE_BOOL_LAYOUT_DUMP_FLAG(wait_until_done) + DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG(wait_until_done) -#undef DEFINE_BOOL_LAYOUT_DUMP_FLAG +#undef DEFINE_BOOL_LAYOUT_TEST_RUNTIME_FLAG // Reports whether recursing over child frames is necessary. bool dump_child_frames() const { @@ -81,9 +83,9 @@ class TEST_RUNNER_EXPORT LayoutDumpFlags { private: TrackedDictionary dict_; - DISALLOW_COPY_AND_ASSIGN(LayoutDumpFlags); + DISALLOW_COPY_AND_ASSIGN(LayoutTestRuntimeFlags); }; } // namespace test_runner -#endif // COMPONENTS_TEST_RUNNER_LAYOUT_DUMP_FLAGS_H_ +#endif // COMPONENTS_TEST_RUNNER_LAYOUT_TEST_RUNTIME_FLAGS_H_ diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc index 3282deb..a5cf186 100644 --- a/components/test_runner/test_runner.cc +++ b/components/test_runner/test_runner.cc @@ -1616,7 +1616,7 @@ void TestRunner::WorkQueue::ProcessWorkSoon() { if (!queue_.empty()) { // We delay processing queued work to avoid recursion problems. controller_->delegate_->PostTask(new WorkQueueTask(this)); - } else if (!controller_->layout_dump_flags_.wait_until_done()) { + } else if (!controller_->layout_test_runtime_flags_.wait_until_done()) { controller_->delegate_->TestFinished(); } } @@ -1648,7 +1648,7 @@ void TestRunner::WorkQueue::ProcessWork() { return; } - if (!controller_->layout_dump_flags_.wait_until_done() && + if (!controller_->layout_test_runtime_flags_.wait_until_done() && !controller_->topLoadingFrame()) controller_->delegate_->TestFinished(); } @@ -1704,7 +1704,7 @@ void TestRunner::Reset() { } top_loading_frame_ = nullptr; - layout_dump_flags_.Reset(); + layout_test_runtime_flags_.Reset(); mock_screen_orientation_client_->ResetData(); wait_until_external_url_load_ = false; policy_delegate_enabled_ = false; @@ -1794,13 +1794,13 @@ bool TestRunner::shouldDumpEditingCallbacks() const { } void TestRunner::setShouldDumpAsText(bool value) { - layout_dump_flags_.set_dump_as_text(value); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_as_text(value); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::setShouldDumpAsMarkup(bool value) { - layout_dump_flags_.set_dump_as_markup(value); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_as_markup(value); + OnLayoutTestRuntimeFlagsChanged(); } bool TestRunner::shouldDumpAsCustomText() const { @@ -1818,7 +1818,7 @@ void TestRunner::setCustomTextOutput(const std::string& text) { bool TestRunner::ShouldGeneratePixelResults() { CheckResponseMimeType(); - return layout_dump_flags_.generate_pixel_results(); + return layout_test_runtime_flags_.generate_pixel_results(); } bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { @@ -1827,8 +1827,8 @@ bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { void TestRunner::setShouldGeneratePixelResults(bool value) { - layout_dump_flags_.set_generate_pixel_results(value); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_generate_pixel_results(value); + OnLayoutTestRuntimeFlagsChanged(); } bool TestRunner::ShouldDumpAsAudio() const { @@ -1841,17 +1841,18 @@ void TestRunner::GetAudioData(std::vector<unsigned char>* buffer_view) const { bool TestRunner::IsRecursiveLayoutDumpRequested() { CheckResponseMimeType(); - return layout_dump_flags_.dump_child_frames(); + return layout_test_runtime_flags_.dump_child_frames(); } std::string TestRunner::DumpLayout(blink::WebLocalFrame* frame) { CheckResponseMimeType(); - return ::test_runner::DumpLayout(frame, layout_dump_flags_); + return ::test_runner::DumpLayout(frame, layout_test_runtime_flags_); } -void TestRunner::ReplicateLayoutDumpFlagsChanges( +void TestRunner::ReplicateLayoutTestRuntimeFlagsChanges( const base::DictionaryValue& changed_values) { - layout_dump_flags_.tracked_dictionary().ApplyUntrackedChanges(changed_values); + layout_test_runtime_flags_.tracked_dictionary().ApplyUntrackedChanges( + changed_values); } bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const { @@ -1936,7 +1937,7 @@ bool TestRunner::shouldDumpSelectionRect() const { } bool TestRunner::isPrinting() const { - return layout_dump_flags_.is_printing(); + return layout_test_runtime_flags_.is_printing(); } bool TestRunner::shouldWaitUntilExternalURLLoad() const { @@ -1965,10 +1966,10 @@ WebFrame* TestRunner::topLoadingFrame() const { } void TestRunner::policyDelegateDone() { - DCHECK(layout_dump_flags_.wait_until_done()); + DCHECK(layout_test_runtime_flags_.wait_until_done()); delegate_->TestFinished(); - layout_dump_flags_.set_wait_until_done(false); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_wait_until_done(false); + OnLayoutTestRuntimeFlagsChanged(); } bool TestRunner::policyDelegateEnabled() const { @@ -2065,8 +2066,8 @@ void TestRunner::NotifyDone() { } void TestRunner::WaitUntilDone() { - layout_dump_flags_.set_wait_until_done(true); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_wait_until_done(true); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::QueueBackNavigation(int how_far_back) { @@ -2199,8 +2200,8 @@ void TestRunner::SetCustomPolicyDelegate(gin::Arguments* args) { void TestRunner::WaitForPolicyDelegate() { policy_delegate_enabled_ = true; policy_delegate_should_notify_done_ = true; - layout_dump_flags_.set_wait_until_done(true); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_wait_until_done(true); + OnLayoutTestRuntimeFlagsChanged(); } int TestRunner::WindowCount() { @@ -2653,36 +2654,36 @@ void TestRunner::DumpEditingCallbacks() { } void TestRunner::DumpAsMarkup() { - layout_dump_flags_.set_dump_as_markup(true); - layout_dump_flags_.set_generate_pixel_results(false); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_as_markup(true); + layout_test_runtime_flags_.set_generate_pixel_results(false); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::DumpAsText() { - layout_dump_flags_.set_dump_as_text(true); - layout_dump_flags_.set_generate_pixel_results(false); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_as_text(true); + layout_test_runtime_flags_.set_generate_pixel_results(false); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::DumpAsTextWithPixelResults() { - layout_dump_flags_.set_dump_as_text(true); - layout_dump_flags_.set_generate_pixel_results(true); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_as_text(true); + layout_test_runtime_flags_.set_generate_pixel_results(true); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::DumpChildFrameScrollPositions() { - layout_dump_flags_.set_dump_child_frame_scroll_positions(true); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_child_frame_scroll_positions(true); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::DumpChildFramesAsMarkup() { - layout_dump_flags_.set_dump_child_frames_as_markup(true); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_child_frames_as_markup(true); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::DumpChildFramesAsText() { - layout_dump_flags_.set_dump_child_frames_as_text(true); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_child_frames_as_text(true); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::DumpIconChanges() { @@ -2781,13 +2782,13 @@ void TestRunner::DumpSelectionRect() { } void TestRunner::SetPrinting() { - layout_dump_flags_.set_is_printing(true); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_is_printing(true); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::ClearPrinting() { - layout_dump_flags_.set_is_printing(false); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_is_printing(false); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) { @@ -3045,13 +3046,13 @@ void TestRunner::CapturePixelsAsyncThen(v8::Local<v8::Function> callback) { base::Passed(&task))); } -void TestRunner::OnLayoutDumpFlagsChanged() { - if (layout_dump_flags_.tracked_dictionary().changed_values().empty()) +void TestRunner::OnLayoutTestRuntimeFlagsChanged() { + if (layout_test_runtime_flags_.tracked_dictionary().changed_values().empty()) return; - delegate_->OnLayoutDumpFlagsChanged( - layout_dump_flags_.tracked_dictionary().changed_values()); - layout_dump_flags_.tracked_dictionary().ResetChangeTracking(); + delegate_->OnLayoutTestRuntimeFlagsChanged( + layout_test_runtime_flags_.tracked_dictionary().changed_values()); + layout_test_runtime_flags_.tracked_dictionary().ResetChangeTracking(); } void TestRunner::ForceNextWebGLContextCreationToFail() { @@ -3171,7 +3172,7 @@ void TestRunner::LocationChangeDone() { // No more new work after the first complete load. work_queue_.set_frozen(true); - if (!layout_dump_flags_.wait_until_done()) + if (!layout_test_runtime_flags_.wait_until_done()) work_queue_.ProcessWorkSoon(); } @@ -3179,7 +3180,7 @@ void TestRunner::CheckResponseMimeType() { // Text output: the test page can request different types of output which we // handle here. - if (layout_dump_flags_.dump_as_text()) + if (layout_test_runtime_flags_.dump_as_text()) return; WebDataSource* data_source = web_view_->mainFrame()->dataSource(); @@ -3190,17 +3191,17 @@ void TestRunner::CheckResponseMimeType() { if (mimeType != "text/plain") return; - layout_dump_flags_.set_dump_as_text(true); - layout_dump_flags_.set_generate_pixel_results(false); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_dump_as_text(true); + layout_test_runtime_flags_.set_generate_pixel_results(false); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::CompleteNotifyDone() { - if (layout_dump_flags_.wait_until_done() && !topLoadingFrame() && + if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && work_queue_.is_empty()) delegate_->TestFinished(); - layout_dump_flags_.set_wait_until_done(false); - OnLayoutDumpFlagsChanged(); + layout_test_runtime_flags_.set_wait_until_done(false); + OnLayoutTestRuntimeFlagsChanged(); } void TestRunner::DidAcquirePointerLockInternal() { diff --git a/components/test_runner/test_runner.gyp b/components/test_runner/test_runner.gyp index 341cb48..1d3e9d8 100644 --- a/components/test_runner/test_runner.gyp +++ b/components/test_runner/test_runner.gyp @@ -53,8 +53,8 @@ 'gc_controller.h', 'layout_dump.cc', 'layout_dump.h', - 'layout_dump_flags.cc', - 'layout_dump_flags.h', + 'layout_test_runtime_flags.cc', + 'layout_test_runtime_flags.h', 'mock_color_chooser.cc', 'mock_color_chooser.h', 'mock_credential_manager_client.cc', diff --git a/components/test_runner/test_runner.h b/components/test_runner/test_runner.h index d4f3ed9..be68d1d 100644 --- a/components/test_runner/test_runner.h +++ b/components/test_runner/test_runner.h @@ -15,7 +15,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "components/test_runner/layout_dump_flags.h" +#include "components/test_runner/layout_test_runtime_flags.h" #include "components/test_runner/test_runner_export.h" #include "components/test_runner/web_task.h" #include "components/test_runner/web_test_runner.h" @@ -75,7 +75,7 @@ class TestRunner : public WebTestRunner, void GetAudioData(std::vector<unsigned char>* buffer_view) const override; bool IsRecursiveLayoutDumpRequested() override; std::string DumpLayout(blink::WebLocalFrame* frame) override; - void ReplicateLayoutDumpFlagsChanges( + void ReplicateLayoutTestRuntimeFlagsChanges( const base::DictionaryValue& changed_values) override; bool HasCustomTextDump(std::string* custom_text_dump) const override; bool ShouldDumpBackForwardList() const override; @@ -627,8 +627,9 @@ class TestRunner : public WebTestRunner, void GetManifestThen(v8::Local<v8::Function> callback); - // Takes care of notifying the delegate after a change to layout dump flags. - void OnLayoutDumpFlagsChanged(); + // Takes care of notifying the delegate after a change to layout test runtime + // flags. + void OnLayoutTestRuntimeFlagsChanged(); /////////////////////////////////////////////////////////////////////////// // Internal helpers @@ -704,7 +705,7 @@ class TestRunner : public WebTestRunner, bool dump_editting_callbacks_; // Flags controlling what content gets dumped as a layout text result. - LayoutDumpFlags layout_dump_flags_; + LayoutTestRuntimeFlags layout_test_runtime_flags_; // If true, the test_shell will print out the icon change notifications. bool dump_icon_changes_; diff --git a/components/test_runner/web_test_delegate.h b/components/test_runner/web_test_delegate.h index ef5dddf..c9b1b4c 100644 --- a/components/test_runner/web_test_delegate.h +++ b/components/test_runner/web_test_delegate.h @@ -207,8 +207,8 @@ class WebTestDelegate { // Sets the POSIX locale of the current process. virtual void SetLocale(const std::string& locale) = 0; - // Invoked when layout dump flags change. - virtual void OnLayoutDumpFlagsChanged( + // Invoked when layout test runtime flags change. + virtual void OnLayoutTestRuntimeFlagsChanged( const base::DictionaryValue& changed_values) = 0; // Invoked when the test finished. diff --git a/components/test_runner/web_test_runner.h b/components/test_runner/web_test_runner.h index 9b808ab..9080c9d 100644 --- a/components/test_runner/web_test_runner.h +++ b/components/test_runner/web_test_runner.h @@ -42,9 +42,10 @@ class WebTestRunner { // (i.e. text mode if testRunner.dumpAsText() was called from javascript). virtual std::string DumpLayout(blink::WebLocalFrame* frame) = 0; - // Replicates changes to layout dump flags (i.e. changes that happened in - // another renderer). See also WebTestDelegate::OnLayoutDumpFlagsChanged. - virtual void ReplicateLayoutDumpFlagsChanges( + // Replicates changes to layout test runtime flags + // (i.e. changes that happened in another renderer). + // See also WebTestDelegate::OnLayoutTestRuntimeFlagsChanged. + virtual void ReplicateLayoutTestRuntimeFlagsChanges( const base::DictionaryValue& changed_values) = 0; // If custom text dump is present (i.e. if testRunner.setCustomTextOutput has diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc index b823e7f..87a286f 100644 --- a/content/shell/browser/layout_test/blink_test_controller.cc +++ b/content/shell/browser/layout_test/blink_test_controller.cc @@ -269,7 +269,7 @@ bool BlinkTestController::PrepareForLayoutTest( printer_->reset(); frame_to_layout_dump_map_.clear(); render_process_host_observer_.RemoveAll(); - accumulated_layout_dump_flags_changes_.Clear(); + accumulated_layout_test_runtime_flags_changes_.Clear(); ShellBrowserContext* browser_context = ShellContentBrowserClient::Get()->browser_context(); if (test_url.spec().find("compositing/") != std::string::npos) @@ -441,8 +441,8 @@ bool BlinkTestController::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(BlinkTestController, message, render_frame_host) - IPC_MESSAGE_HANDLER(ShellViewHostMsg_LayoutDumpFlagsChanged, - OnLayoutDumpFlagsChanged) + IPC_MESSAGE_HANDLER(ShellViewHostMsg_LayoutTestRuntimeFlagsChanged, + OnLayoutTestRuntimeFlagsChanged) IPC_MESSAGE_HANDLER(ShellViewHostMsg_LayoutDumpResponse, OnLayoutDumpResponse) IPC_MESSAGE_UNHANDLED(handled = false) @@ -600,7 +600,8 @@ void BlinkTestController::HandleNewRenderFrameHost(RenderFrameHost* frame) { if (did_send_initial_test_configuration_) { frame->Send(new ShellViewMsg_ReplicateTestConfiguration( - frame->GetRoutingID(), params, accumulated_layout_dump_flags_changes_)); + frame->GetRoutingID(), params, + accumulated_layout_test_runtime_flags_changes_)); } else { did_send_initial_test_configuration_ = true; frame->Send( @@ -675,12 +676,12 @@ void BlinkTestController::OnInitiateLayoutDump() { new ShellViewMsg_LayoutDumpRequest(MSG_ROUTING_NONE)); } -void BlinkTestController::OnLayoutDumpFlagsChanged( +void BlinkTestController::OnLayoutTestRuntimeFlagsChanged( RenderFrameHost* sender, - const base::DictionaryValue& changed_layout_dump_flags) { + const base::DictionaryValue& changed_layout_test_runtime_flags) { // Stash the changes for future renderers. - accumulated_layout_dump_flags_changes_.MergeDictionary( - &changed_layout_dump_flags); + accumulated_layout_test_runtime_flags_changes_.MergeDictionary( + &changed_layout_test_runtime_flags); // Only need to send the propagation message once per renderer process. std::set<int> already_covered_process_ids; @@ -696,8 +697,8 @@ void BlinkTestController::OnLayoutDumpFlagsChanged( bool inserted_new_item = already_covered_process_ids.insert(frame->GetProcess()->GetID()).second; if (inserted_new_item) { - frame->Send(new ShellViewMsg_ReplicateLayoutDumpFlagsChanges( - frame->GetRoutingID(), changed_layout_dump_flags)); + frame->Send(new ShellViewMsg_ReplicateLayoutTestRuntimeFlagsChanges( + frame->GetRoutingID(), changed_layout_test_runtime_flags)); } } } diff --git a/content/shell/browser/layout_test/blink_test_controller.h b/content/shell/browser/layout_test/blink_test_controller.h index 10d4a44..0443eab 100644 --- a/content/shell/browser/layout_test/blink_test_controller.h +++ b/content/shell/browser/layout_test/blink_test_controller.h @@ -192,9 +192,9 @@ class BlinkTestController : public base::NonThreadSafe, void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); void OnTextDump(const std::string& dump); void OnInitiateLayoutDump(); - void OnLayoutDumpFlagsChanged( + void OnLayoutTestRuntimeFlagsChanged( RenderFrameHost* sender, - const base::DictionaryValue& changed_layout_dump_flags); + const base::DictionaryValue& changed_layout_test_runtime_flags); void OnLayoutDumpResponse(RenderFrameHost* sender, const std::string& dump); void OnPrintMessage(const std::string& message); void OnOverridePreferences(const WebPreferences& prefs); @@ -266,10 +266,10 @@ class BlinkTestController : public base::NonThreadSafe, ScopedObserver<RenderProcessHost, RenderProcessHostObserver> render_process_host_observer_; - // Changes reported by OnLayoutDumpFlagsChanged that have accumulated since - // PrepareForLayoutTest (i.e. changes that need to be send to a fresh + // Changes reported by OnLayoutTestRuntimeFlagsChanged that have accumulated + // since PrepareForLayoutTest (i.e. changes that need to be send to a fresh // renderer created while test is in progress). - base::DictionaryValue accumulated_layout_dump_flags_changes_; + base::DictionaryValue accumulated_layout_test_runtime_flags_changes_; #if defined(OS_ANDROID) // Because of the nested message pump implementation, Android needs to allow diff --git a/content/shell/common/layout_test/layout_test_content_client.cc b/content/shell/common/layout_test/layout_test_content_client.cc index 8c7a533..da2e962 100644 --- a/content/shell/common/layout_test/layout_test_content_client.cc +++ b/content/shell/common/layout_test/layout_test_content_client.cc @@ -13,7 +13,7 @@ bool LayoutTestContentClient::CanSendWhileSwappedOut( switch (message->type()) { // Used in layout tests; handled in BlinkTestController. case ShellViewHostMsg_PrintMessage::ID: - case ShellViewHostMsg_LayoutDumpFlagsChanged::ID: + case ShellViewHostMsg_LayoutTestRuntimeFlagsChanged::ID: return true; default: diff --git a/content/shell/common/shell_messages.h b/content/shell/common/shell_messages.h index 8937138..c057f25 100644 --- a/content/shell/common/shell_messages.h +++ b/content/shell/common/shell_messages.h @@ -43,11 +43,12 @@ IPC_MESSAGE_ROUTED1(ShellViewMsg_SetTestConfiguration, IPC_MESSAGE_ROUTED2( ShellViewMsg_ReplicateTestConfiguration, content::ShellTestConfiguration, - base::DictionaryValue /* accumulated_layout_dump_flags_changes */) + base::DictionaryValue /* accumulated_layout_test_runtime_flags_changes */) // Used to broadcast changes happening in one renderer to all other renderers. -IPC_MESSAGE_ROUTED1(ShellViewMsg_ReplicateLayoutDumpFlagsChanges, - base::DictionaryValue /* changed_layout_dump_flags */) +IPC_MESSAGE_ROUTED1( + ShellViewMsg_ReplicateLayoutTestRuntimeFlagsChanges, + base::DictionaryValue /* changed_layout_test_runtime_flags */) // Tells the main window that a secondary renderer in a different process thinks // the test is finished. @@ -73,9 +74,11 @@ IPC_MESSAGE_ROUTED0(ShellViewMsg_LayoutDumpRequest) IPC_MESSAGE_ROUTED1(ShellViewMsg_LayoutDumpCompleted, std::string /* completed/stitched layout dump */) -// Notifies the browser that one of renderers has changed layout dump flags. -IPC_MESSAGE_ROUTED1(ShellViewHostMsg_LayoutDumpFlagsChanged, - base::DictionaryValue /* changed_layout_dump_flags */) +// Notifies the browser that one of renderers has changed layout test runtime +// flags (i.e. has set dump_as_text). +IPC_MESSAGE_ROUTED1( + ShellViewHostMsg_LayoutTestRuntimeFlagsChanged, + base::DictionaryValue /* changed_layout_test_runtime_flags */) // Send a text dump of the WebContents to the render host. IPC_MESSAGE_ROUTED1(ShellViewHostMsg_TextDump, diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc index 76f1fcc..e9d228f 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.cc +++ b/content/shell/renderer/layout_test/blink_test_runner.cc @@ -573,7 +573,7 @@ void BlinkTestRunner::SetLocale(const std::string& locale) { setlocale(LC_ALL, locale.c_str()); } -void BlinkTestRunner::OnLayoutDumpFlagsChanged( +void BlinkTestRunner::OnLayoutTestRuntimeFlagsChanged( const base::DictionaryValue& changed_values) { // Ignore changes that happen before we got the initial, accumulated // layout flag changes in ShellViewMsg_ReplicateTestConfiguration. @@ -592,8 +592,8 @@ void BlinkTestRunner::OnLayoutDumpFlagsChanged( } } DCHECK(local_frame); - Send(new ShellViewHostMsg_LayoutDumpFlagsChanged(local_frame->GetRoutingID(), - changed_values)); + Send(new ShellViewHostMsg_LayoutTestRuntimeFlagsChanged( + local_frame->GetRoutingID(), changed_values)); } void BlinkTestRunner::TestFinished() { diff --git a/content/shell/renderer/layout_test/blink_test_runner.h b/content/shell/renderer/layout_test/blink_test_runner.h index a919b84..3a4156f 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.h +++ b/content/shell/renderer/layout_test/blink_test_runner.h @@ -116,7 +116,7 @@ class BlinkTestRunner : public RenderViewObserver, void SetAcceptAllCookies(bool accept) override; std::string PathToLocalResource(const std::string& resource) override; void SetLocale(const std::string& locale) override; - void OnLayoutDumpFlagsChanged( + void OnLayoutTestRuntimeFlagsChanged( const base::DictionaryValue& changed_values) override; void TestFinished() override; void CloseRemainingWindows() override; diff --git a/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc b/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc index 806ec1c..8fa6569 100644 --- a/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc +++ b/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc @@ -32,8 +32,8 @@ bool LayoutTestRenderFrameObserver::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP(LayoutTestRenderFrameObserver, message) IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpRequest, OnLayoutDumpRequest) - IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateLayoutDumpFlagsChanges, - OnReplicateLayoutDumpFlagsChanges) + IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateLayoutTestRuntimeFlagsChanges, + OnReplicateLayoutTestRuntimeFlagsChanges) IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateTestConfiguration, OnReplicateTestConfiguration) IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, @@ -53,22 +53,25 @@ void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() { Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump)); } -void LayoutTestRenderFrameObserver::OnReplicateLayoutDumpFlagsChanges( - const base::DictionaryValue& changed_layout_dump_flags) { +void LayoutTestRenderFrameObserver::OnReplicateLayoutTestRuntimeFlagsChanges( + const base::DictionaryValue& changed_layout_test_runtime_flags) { LayoutTestRenderProcessObserver::GetInstance() ->test_interfaces() ->TestRunner() - ->ReplicateLayoutDumpFlagsChanges(changed_layout_dump_flags); + ->ReplicateLayoutTestRuntimeFlagsChanges( + changed_layout_test_runtime_flags); } void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration( const ShellTestConfiguration& test_config, - const base::DictionaryValue& accumulated_layout_dump_flags_changes) { + const base::DictionaryValue& + accumulated_layout_test_runtime_flags_changes) { LayoutTestRenderProcessObserver::GetInstance() ->main_test_runner() ->OnReplicateTestConfiguration(test_config); - OnReplicateLayoutDumpFlagsChanges(accumulated_layout_dump_flags_changes); + OnReplicateLayoutTestRuntimeFlagsChanges( + accumulated_layout_test_runtime_flags_changes); } void LayoutTestRenderFrameObserver::OnSetTestConfiguration( diff --git a/content/shell/renderer/layout_test/layout_test_render_frame_observer.h b/content/shell/renderer/layout_test/layout_test_render_frame_observer.h index 4b0cc78..0517faf 100644 --- a/content/shell/renderer/layout_test/layout_test_render_frame_observer.h +++ b/content/shell/renderer/layout_test/layout_test_render_frame_observer.h @@ -30,12 +30,13 @@ class LayoutTestRenderFrameObserver : public RenderFrameObserver { private: void OnLayoutDumpRequest(); - void OnReplicateLayoutDumpFlagsChanges( - const base::DictionaryValue& changed_layout_dump_flags); + void OnReplicateLayoutTestRuntimeFlagsChanges( + const base::DictionaryValue& changed_layout_test_runtime_flags); void OnSetTestConfiguration(const ShellTestConfiguration& test_config); void OnReplicateTestConfiguration( const ShellTestConfiguration& test_config, - const base::DictionaryValue& accumulated_layout_dump_flags_changes); + const base::DictionaryValue& + accumulated_layout_test_runtime_flags_changes); DISALLOW_COPY_AND_ASSIGN(LayoutTestRenderFrameObserver); }; |