Commit 34e43ad7 authored by aurimas's avatar aurimas Committed by Commit bot

Revert of Disable user gesture checking for all autofill browser tests....

Revert of Disable user gesture checking for all autofill browser tests. (patchset #2 id:20001 of https://codereview.chromium.org/1125173006/)

Reason for revert:
This CL broke Linux GN Clobber bot.

Original issue's description:
> Disable user gesture checking for all autofill browser tests.
>
> When drmemory_full runs, the browser tests are slowed down enough to
> timeout the user gesture indicator, which prevents autofill from
> processing the input and passing the browser test. The fix is to disable
> user gesture checking for all autofill browser tests except
> AutofillRendererTest.IgnoreNonUserGestureTextFieldChanges.
>
> BUG=484910

TBR=estade@chromium.org,thestig@chromium.org,rouslan@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=484910

Review URL: https://codereview.chromium.org/1140013004

Cr-Commit-Position: refs/heads/master@{#330272}
parent c8f25a26
...@@ -258,7 +258,6 @@ TEST_F(AutofillRendererTest, IgnoreNonUserGestureTextFieldChanges) { ...@@ -258,7 +258,6 @@ TEST_F(AutofillRendererTest, IgnoreNonUserGestureTextFieldChanges) {
GetMainFrame()->view()->advanceFocus(false); GetMainFrame()->view()->advanceFocus(false);
// Not a user gesture, so no IPC message to browser. // Not a user gesture, so no IPC message to browser.
DisableUserGestureSimulationForAutofill();
full_name.setValue("Alice", true); full_name.setValue("Alice", true);
GetMainFrame()->toWebLocalFrame()->autofillClient()->textFieldDidChange( GetMainFrame()->toWebLocalFrame()->autofillClient()->textFieldDidChange(
full_name); full_name);
...@@ -267,7 +266,6 @@ TEST_F(AutofillRendererTest, IgnoreNonUserGestureTextFieldChanges) { ...@@ -267,7 +266,6 @@ TEST_F(AutofillRendererTest, IgnoreNonUserGestureTextFieldChanges) {
AutofillHostMsg_TextFieldDidChange::ID)); AutofillHostMsg_TextFieldDidChange::ID));
// A user gesture will send a message to the browser. // A user gesture will send a message to the browser.
EnableUserGestureSimulationForAutofill();
SimulateUserInputChangeForElement(&full_name, "Alice"); SimulateUserInputChangeForElement(&full_name, "Alice");
ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching( ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching(
AutofillHostMsg_TextFieldDidChange::ID)); AutofillHostMsg_TextFieldDidChange::ID));
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/common/renderer_preferences.h" #include "content/public/common/renderer_preferences.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h" #include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebInputEvent.h" #include "third_party/WebKit/public/web/WebInputEvent.h"
...@@ -45,34 +44,6 @@ using blink::WebScriptController; ...@@ -45,34 +44,6 @@ using blink::WebScriptController;
using blink::WebScriptSource; using blink::WebScriptSource;
using blink::WebString; using blink::WebString;
using blink::WebURLRequest; using blink::WebURLRequest;
using content::RenderFrame;
using testing::NiceMock;
using testing::Return;
using testing::_;
namespace {
// An autofill agent that treats all typing as user gesture.
class MockAutofillAgent : public AutofillAgent {
public:
MockAutofillAgent(RenderFrame* render_frame,
PasswordAutofillAgent* password_autofill_agent,
PasswordGenerationAgent* password_generation_agent)
: AutofillAgent(render_frame,
password_autofill_agent,
password_generation_agent) {
ON_CALL(*this, IsUserGesture()).WillByDefault(Return(true));
}
~MockAutofillAgent() override {}
MOCK_CONST_METHOD0(IsUserGesture, bool());
private:
DISALLOW_COPY_AND_ASSIGN(MockAutofillAgent);
};
} // namespace
ChromeRenderViewTest::ChromeRenderViewTest() ChromeRenderViewTest::ChromeRenderViewTest()
: password_autofill_agent_(NULL), : password_autofill_agent_(NULL),
...@@ -100,9 +71,9 @@ void ChromeRenderViewTest::SetUp() { ...@@ -100,9 +71,9 @@ void ChromeRenderViewTest::SetUp() {
new autofill::TestPasswordAutofillAgent(view_->GetMainRenderFrame()); new autofill::TestPasswordAutofillAgent(view_->GetMainRenderFrame());
password_generation_ = password_generation_ =
new autofill::TestPasswordGenerationAgent(view_->GetMainRenderFrame()); new autofill::TestPasswordGenerationAgent(view_->GetMainRenderFrame());
autofill_agent_ = new NiceMock<MockAutofillAgent>(view_->GetMainRenderFrame(), autofill_agent_ =
password_autofill_agent_, new AutofillAgent(view_->GetMainRenderFrame(), password_autofill_agent_,
password_generation_); password_generation_);
} }
void ChromeRenderViewTest::TearDown() { void ChromeRenderViewTest::TearDown() {
...@@ -125,12 +96,12 @@ content::ContentClient* ChromeRenderViewTest::CreateContentClient() { ...@@ -125,12 +96,12 @@ content::ContentClient* ChromeRenderViewTest::CreateContentClient() {
} }
content::ContentBrowserClient* content::ContentBrowserClient*
ChromeRenderViewTest::CreateContentBrowserClient() { ChromeRenderViewTest::CreateContentBrowserClient() {
return new chrome::ChromeContentBrowserClient(); return new chrome::ChromeContentBrowserClient();
} }
content::ContentRendererClient* content::ContentRendererClient*
ChromeRenderViewTest::CreateContentRendererClient() { ChromeRenderViewTest::CreateContentRendererClient() {
ChromeContentRendererClient* client = new ChromeContentRendererClient(); ChromeContentRendererClient* client = new ChromeContentRendererClient();
#if defined(ENABLE_EXTENSIONS) #if defined(ENABLE_EXTENSIONS)
extension_dispatcher_delegate_.reset( extension_dispatcher_delegate_.reset(
...@@ -143,13 +114,3 @@ ChromeRenderViewTest::CreateContentRendererClient() { ...@@ -143,13 +114,3 @@ ChromeRenderViewTest::CreateContentRendererClient() {
#endif #endif
return client; return client;
} }
void ChromeRenderViewTest::EnableUserGestureSimulationForAutofill() {
EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)),
IsUserGesture()).WillRepeatedly(Return(true));
}
void ChromeRenderViewTest::DisableUserGestureSimulationForAutofill() {
EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)),
IsUserGesture()).WillRepeatedly(Return(false));
}
...@@ -34,9 +34,6 @@ class ChromeRenderViewTest : public content::RenderViewTest { ...@@ -34,9 +34,6 @@ class ChromeRenderViewTest : public content::RenderViewTest {
content::ContentBrowserClient* CreateContentBrowserClient() override; content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentRendererClient* CreateContentRendererClient() override; content::ContentRendererClient* CreateContentRendererClient() override;
void EnableUserGestureSimulationForAutofill();
void DisableUserGestureSimulationForAutofill();
#if defined(ENABLE_EXTENSIONS) #if defined(ENABLE_EXTENSIONS)
scoped_ptr<extensions::DispatcherDelegate> extension_dispatcher_delegate_; scoped_ptr<extensions::DispatcherDelegate> extension_dispatcher_delegate_;
#endif #endif
......
...@@ -388,7 +388,7 @@ void AutofillAgent::textFieldDidChange(const WebFormControlElement& element) { ...@@ -388,7 +388,7 @@ void AutofillAgent::textFieldDidChange(const WebFormControlElement& element) {
if (ignore_text_changes_) if (ignore_text_changes_)
return; return;
if (!IsUserGesture()) if (!WebUserGestureIndicator::isProcessingUserGesture())
return; return;
// We post a task for doing the Autofill as the caret position is not set // We post a task for doing the Autofill as the caret position is not set
...@@ -752,10 +752,6 @@ void AutofillAgent::HidePopup() { ...@@ -752,10 +752,6 @@ void AutofillAgent::HidePopup() {
Send(new AutofillHostMsg_HidePopup(routing_id())); Send(new AutofillHostMsg_HidePopup(routing_id()));
} }
bool AutofillAgent::IsUserGesture() const {
return WebUserGestureIndicator::isProcessingUserGesture();
}
void AutofillAgent::didAssociateFormControls(const WebVector<WebNode>& nodes) { void AutofillAgent::didAssociateFormControls(const WebVector<WebNode>& nodes) {
for (size_t i = 0; i < nodes.size(); ++i) { for (size_t i = 0; i < nodes.size(); ++i) {
WebLocalFrame* frame = nodes[i].document().frame(); WebLocalFrame* frame = nodes[i].document().frame();
......
...@@ -221,10 +221,6 @@ class AutofillAgent : public content::RenderFrameObserver, ...@@ -221,10 +221,6 @@ class AutofillAgent : public content::RenderFrameObserver,
// Hides any currently showing Autofill popup. // Hides any currently showing Autofill popup.
void HidePopup(); void HidePopup();
// Returns true if the text field change is due to a user gesture. Can be
// overriden in tests.
virtual bool IsUserGesture() const;
// Formerly cached forms for all frames, now only caches forms for the current // Formerly cached forms for all frames, now only caches forms for the current
// frame. // frame.
FormCache form_cache_; FormCache form_cache_;
......
...@@ -35,3 +35,8 @@ BasicExtensionSettingsWebUITest.testUninstall ...@@ -35,3 +35,8 @@ BasicExtensionSettingsWebUITest.testUninstall
# https://crbug.com/480721 # https://crbug.com/480721
OutOfProcessProxyResolverBrowserTest.Verify OutOfProcessProxyResolverBrowserTest.Verify
# https://crbug.com/484910
PasswordAutofillAgentTest.ClearPreviewWithInlineAutocompletedUsername
PasswordAutofillAgentTest.InlineAutocomplete
PasswordAutofillAgentTest.RememberLastNonEmptyUsernameAndPasswordOnSubmit_UserCleared
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