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

Unified Diff: components/test_runner/test_runner.cc

Issue 1736353002: ABANDONED CL: Shared-memory-based approach to layout tests runtime flags replication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/test_runner.cc
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index b85bc61f1d4c151616a29c855daee6a2654960a0..312f708c86d5329b4309ab70d951a6ed9f672ecb 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -14,6 +14,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
+#include "components/test_runner/layout_dump_flags.h"
#include "components/test_runner/mock_credential_manager_client.h"
#include "components/test_runner/mock_web_speech_recognizer.h"
#include "components/test_runner/test_interfaces.h"
@@ -1610,7 +1611,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_->wait_until_done_) {
+ } else if (!controller_->layout_dump_flags()->wait_until_done) {
controller_->delegate_->TestFinished();
}
}
@@ -1642,7 +1643,8 @@ void TestRunner::WorkQueue::ProcessWork() {
return;
}
- if (!controller_->wait_until_done_ && !controller_->topLoadingFrame())
+ if (!controller_->layout_dump_flags()->wait_until_done &&
+ !controller_->topLoadingFrame())
controller_->delegate_->TestFinished();
}
@@ -1657,13 +1659,7 @@ TestRunner::TestRunner(TestInterfaces* interfaces)
disable_notify_done_(false),
web_history_item_count_(0),
intercept_post_message_(false),
- layout_dump_flags_(
- false, // dump_as_text
- false, // dump_child_frames_as_text
- false, // dump_as_markup
- false, // dump_child_frames_as_markup
- false, // dump_child_frame_scroll_positions
- false), // is_printing
+ layout_dump_flags_(nullptr),
test_interfaces_(interfaces),
delegate_(nullptr),
web_view_(nullptr),
@@ -1704,7 +1700,9 @@ void TestRunner::Reset() {
}
top_loading_frame_ = nullptr;
- wait_until_done_ = false;
+ // TODO / DO NOT SUBMIT - memory fence needed here and in other places :-/.
+ layout_dump_flags()->wait_until_done = false;
+ // TODO / DO NOT SUBMIT - memory fence needed here and in other places :-/.
wait_until_external_url_load_ = false;
policy_delegate_enabled_ = false;
policy_delegate_is_permissive_ = false;
@@ -1733,12 +1731,12 @@ void TestRunner::Reset() {
}
dump_editting_callbacks_ = false;
- layout_dump_flags_.dump_as_text = false;
- layout_dump_flags_.dump_as_markup = false;
- generate_pixel_results_ = true;
- layout_dump_flags_.dump_child_frame_scroll_positions = false;
- layout_dump_flags_.dump_child_frames_as_text = false;
- layout_dump_flags_.dump_child_frames_as_markup = false;
+ layout_dump_flags()->dump_as_text = false;
+ layout_dump_flags()->dump_as_markup = false;
+ layout_dump_flags()->generate_pixel_results = true;
+ layout_dump_flags()->dump_child_frame_scroll_positions = false;
+ layout_dump_flags()->dump_child_frames_as_text = false;
+ layout_dump_flags()->dump_child_frames_as_markup = false;
dump_icon_changes_ = false;
dump_as_audio_ = false;
dump_frame_load_callbacks_ = false;
@@ -1758,7 +1756,7 @@ void TestRunner::Reset() {
dump_navigation_policy_ = false;
test_repaint_ = false;
sweep_horizontally_ = false;
- layout_dump_flags_.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;
@@ -1793,6 +1791,12 @@ void TestRunner::SetTestIsRunning(bool running) {
test_is_running_ = running;
}
+void TestRunner::SetSharedLayoutDumpFlags(
+ LayoutDumpFlags* shared_layout_dump_flags) {
+ DCHECK(shared_layout_dump_flags);
+ layout_dump_flags_ = shared_layout_dump_flags;
+}
+
void TestRunner::InvokeCallback(scoped_ptr<InvokeCallbackTask> task) {
delegate_->PostTask(task.release());
}
@@ -1802,11 +1806,11 @@ bool TestRunner::shouldDumpEditingCallbacks() const {
}
void TestRunner::setShouldDumpAsText(bool value) {
- layout_dump_flags_.dump_as_text = value;
+ layout_dump_flags()->dump_as_text = value;
}
void TestRunner::setShouldDumpAsMarkup(bool value) {
- layout_dump_flags_.dump_as_markup = value;
+ layout_dump_flags()->dump_as_markup = value;
}
bool TestRunner::shouldDumpAsCustomText() const {
@@ -1824,7 +1828,7 @@ void TestRunner::setCustomTextOutput(const std::string& text) {
bool TestRunner::ShouldGeneratePixelResults() {
CheckResponseMimeType();
- return generate_pixel_results_;
+ return layout_dump_flags()->generate_pixel_results;
}
bool TestRunner::ShouldStayOnPageAfterHandlingBeforeUnload() const {
@@ -1833,7 +1837,7 @@ bool TestRunner::ShouldStayOnPageAfterHandlingBeforeUnload() const {
void TestRunner::setShouldGeneratePixelResults(bool value) {
- generate_pixel_results_ = value;
+ layout_dump_flags()->generate_pixel_results = value;
}
bool TestRunner::ShouldDumpAsAudio() const {
@@ -1846,7 +1850,7 @@ void TestRunner::GetAudioData(std::vector<unsigned char>* buffer_view) const {
const LayoutDumpFlags& TestRunner::GetLayoutDumpFlags() {
CheckResponseMimeType();
- return layout_dump_flags_;
+ return *layout_dump_flags_;
}
bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const {
@@ -1931,7 +1935,7 @@ bool TestRunner::shouldDumpSelectionRect() const {
}
bool TestRunner::isPrinting() const {
- return layout_dump_flags_.is_printing;
+ return layout_dump_flags()->is_printing;
}
bool TestRunner::shouldWaitUntilExternalURLLoad() const {
@@ -1960,9 +1964,9 @@ WebFrame* TestRunner::topLoadingFrame() const {
}
void TestRunner::policyDelegateDone() {
- DCHECK(wait_until_done_);
+ DCHECK(layout_dump_flags()->wait_until_done);
delegate_->TestFinished();
- wait_until_done_ = false;
+ layout_dump_flags()->wait_until_done = false;
}
bool TestRunner::policyDelegateEnabled() const {
@@ -2062,7 +2066,7 @@ void TestRunner::NotifyDone() {
}
void TestRunner::WaitUntilDone() {
- wait_until_done_ = true;
+ layout_dump_flags()->wait_until_done = true;
}
void TestRunner::QueueBackNavigation(int how_far_back) {
@@ -2195,7 +2199,7 @@ void TestRunner::SetCustomPolicyDelegate(gin::Arguments* args) {
void TestRunner::WaitForPolicyDelegate() {
policy_delegate_enabled_ = true;
policy_delegate_should_notify_done_ = true;
- wait_until_done_ = true;
+ layout_dump_flags()->wait_until_done = true;
}
int TestRunner::WindowCount() {
@@ -2640,30 +2644,30 @@ void TestRunner::DumpEditingCallbacks() {
}
void TestRunner::DumpAsMarkup() {
- layout_dump_flags_.dump_as_markup = true;
- generate_pixel_results_ = false;
+ layout_dump_flags()->dump_as_markup = true;
+ layout_dump_flags()->generate_pixel_results = false;
}
void TestRunner::DumpAsText() {
- layout_dump_flags_.dump_as_text = true;
- generate_pixel_results_ = false;
+ layout_dump_flags()->dump_as_text = true;
+ layout_dump_flags()->generate_pixel_results = false;
}
void TestRunner::DumpAsTextWithPixelResults() {
- layout_dump_flags_.dump_as_text = true;
- generate_pixel_results_ = true;
+ layout_dump_flags()->dump_as_text = true;
+ layout_dump_flags()->generate_pixel_results = true;
}
void TestRunner::DumpChildFrameScrollPositions() {
- layout_dump_flags_.dump_child_frame_scroll_positions = true;
+ layout_dump_flags()->dump_child_frame_scroll_positions = true;
}
void TestRunner::DumpChildFramesAsMarkup() {
- layout_dump_flags_.dump_child_frames_as_markup = true;
+ layout_dump_flags()->dump_child_frames_as_markup = true;
}
void TestRunner::DumpChildFramesAsText() {
- layout_dump_flags_.dump_child_frames_as_text = true;
+ layout_dump_flags()->dump_child_frames_as_text = true;
}
void TestRunner::DumpIconChanges() {
@@ -2762,11 +2766,11 @@ void TestRunner::DumpSelectionRect() {
}
void TestRunner::SetPrinting() {
- layout_dump_flags_.is_printing = true;
+ layout_dump_flags()->is_printing = true;
}
void TestRunner::ClearPrinting() {
- layout_dump_flags_.is_printing = false;
+ layout_dump_flags()->is_printing = false;
}
void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) {
@@ -3137,27 +3141,28 @@ void TestRunner::LocationChangeDone() {
// No more new work after the first complete load.
work_queue_.set_frozen(true);
- if (!wait_until_done_)
+ if (!layout_dump_flags()->wait_until_done)
work_queue_.ProcessWorkSoon();
}
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_dump_flags()->dump_as_text) {
std::string mimeType =
web_view_->mainFrame()->dataSource()->response().mimeType().utf8();
if (mimeType == "text/plain") {
- layout_dump_flags_.dump_as_text = true;
- generate_pixel_results_ = false;
+ layout_dump_flags()->dump_as_text = true;
+ layout_dump_flags()->generate_pixel_results = false;
}
}
}
void TestRunner::CompleteNotifyDone() {
- if (wait_until_done_ && !topLoadingFrame() && work_queue_.is_empty())
+ if (layout_dump_flags()->wait_until_done && !topLoadingFrame() &&
+ work_queue_.is_empty())
delegate_->TestFinished();
- wait_until_done_ = false;
+ layout_dump_flags()->wait_until_done = false;
}
void TestRunner::DidAcquirePointerLockInternal() {
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698