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

Side by Side Diff: chrome/browser/download/download_request_limiter_unittest.cc

Issue 1748553002: Replace MouseWheel events with GestureScrollBegin in WebContentsObserver::DidGetUserInteraction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-didgetusergesture
Patch Set: Addressing reviewer comments Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/download_request_limiter.h" 5 #include "chrome/browser/download/download_request_limiter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_ResetOnUserGesture) { 349 TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_ResetOnUserGesture) {
350 NavigateAndCommit(GURL("http://foo.com/bar")); 350 NavigateAndCommit(GURL("http://foo.com/bar"));
351 LoadCompleted(); 351 LoadCompleted();
352 352
353 // Do one download, which should change to prompt before download. 353 // Do one download, which should change to prompt before download.
354 CanDownload(); 354 CanDownload();
355 ExpectAndResetCounts(1, 0, 0, __LINE__); 355 ExpectAndResetCounts(1, 0, 0, __LINE__);
356 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 356 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
357 download_request_limiter_->GetDownloadStatus(web_contents())); 357 download_request_limiter_->GetDownloadStatus(web_contents()));
358 358
359 // Do a user gesture with mouse scroll, which should be ignored. 359 // Do a user gesture with scroll, which should be ignored.
360 OnUserInteraction(blink::WebInputEvent::MouseWheel); 360 OnUserInteraction(blink::WebInputEvent::GestureScrollBegin);
361 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 361 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
362 download_request_limiter_->GetDownloadStatus(web_contents())); 362 download_request_limiter_->GetDownloadStatus(web_contents()));
363 // Do a user gesture with mouse click, which should reset back to allow one. 363 // Do a user gesture with mouse click, which should reset back to allow one.
364 OnUserInteraction(blink::WebInputEvent::MouseDown); 364 OnUserInteraction(blink::WebInputEvent::MouseDown);
365 ASSERT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD, 365 ASSERT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD,
366 download_request_limiter_->GetDownloadStatus(web_contents())); 366 download_request_limiter_->GetDownloadStatus(web_contents()));
367 367
368 // Do one download, which should change to prompt before download. 368 // Do one download, which should change to prompt before download.
369 CanDownload(); 369 CanDownload();
370 ExpectAndResetCounts(1, 0, 0, __LINE__); 370 ExpectAndResetCounts(1, 0, 0, __LINE__);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // changing the content setting). 580 // changing the content setting).
581 UpdateContentSettings(web_contents(), CONTENT_SETTING_ASK); 581 UpdateContentSettings(web_contents(), CONTENT_SETTING_ASK);
582 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 582 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
583 download_request_limiter_->GetDownloadStatus(web_contents())); 583 download_request_limiter_->GetDownloadStatus(web_contents()));
584 UpdateExpectations(WAIT); 584 UpdateExpectations(WAIT);
585 CanDownload(); 585 CanDownload();
586 ExpectAndResetCounts(0, 0, 1, __LINE__); 586 ExpectAndResetCounts(0, 0, 1, __LINE__);
587 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 587 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
588 download_request_limiter_->GetDownloadStatus(web_contents())); 588 download_request_limiter_->GetDownloadStatus(web_contents()));
589 } 589 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_limiter.cc ('k') | chrome/browser/engagement/site_engagement_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698