Commit 8aa27d12 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

aura: disable input throttling in tab dragging tests

Without this code thinks an event has been processed when it may not
have been, which leads to assertions failing. This is only an issue
with the Window Service, which triggers throttling more often.

BUG=817112
TEST=test only change

Change-Id: Ie290dcc827e4be67263f0430c540af271b16ab02
Reviewed-on: https://chromium-review.googlesource.com/954702Reviewed-by: default avatarFady Samuel <fsamuel@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541732}
parent c3298e56
......@@ -52,6 +52,7 @@
#if defined(USE_AURA)
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window_targeter.h"
......@@ -214,6 +215,16 @@ void TabDragControllerTest::SetWindowFinderForTabStrip(
tab_strip->drag_controller_->window_finder_ = std::move(window_finder);
}
void TabDragControllerTest::SetUp() {
#if defined(USE_AURA)
// This needs to be disabled as it can interfere with when events are
// processed. In particular if input throttling is turned on, then when an
// event ack runs the event may not have been processed.
aura::Env::set_initial_throttle_input_on_resize_for_testing(false);
#endif
InProcessBrowserTest::SetUp();
}
void TabDragControllerTest::SetUpCommandLine(base::CommandLine* command_line) {
command_line->AppendSwitch(switches::kDisableResizeLock);
}
......
......@@ -45,6 +45,7 @@ class TabDragControllerTest : public InProcessBrowserTest {
protected:
// InProcessBrowserTest:
void SetUp() override;
void SetUpCommandLine(base::CommandLine* command_line) override;
private:
......
......@@ -152,6 +152,9 @@ void Env::ScheduleEmbed(
////////////////////////////////////////////////////////////////////////////////
// Env, private:
// static
bool Env::initial_throttle_input_on_resize_ = true;
Env::Env(Mode mode)
: mode_(mode),
env_controller_(new EnvInputStateController),
......
......@@ -108,6 +108,12 @@ class AURA_EXPORT Env : public ui::EventTarget,
}
ui::ContextFactory* context_factory() { return context_factory_; }
// Sets |initial_throttle_input_on_resize| the next time Env is created. This
// is only useful in tests that need to disable input resize.
static void set_initial_throttle_input_on_resize_for_testing(
bool throttle_input) {
initial_throttle_input_on_resize_ = throttle_input;
}
void set_throttle_input_on_resize_for_testing(bool throttle_input) {
throttle_input_on_resize_ = throttle_input;
}
......@@ -211,7 +217,8 @@ class AURA_EXPORT Env : public ui::EventTarget,
// creating a different WindowPort implementation.
bool in_mus_shutdown_ = false;
bool throttle_input_on_resize_ = true;
static bool initial_throttle_input_on_resize_;
bool throttle_input_on_resize_ = initial_throttle_input_on_resize_;
DISALLOW_COPY_AND_ASSIGN(Env);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment