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

Issue 56135: Adding unit tests for the SafeBrowsingBlockingPage class (Closed)

Created:
11 years, 8 months ago by jcampan
Modified:
9 years, 7 months ago
Reviewers:
Paul Godavari
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

This CL adds unit-tests for the SafeBrowsingBlockingPage class. This required: - creating a factory to create SafeBrowsingBlockingPage instances (so unit-tests can provide their own sub-classes). - making the code posts tasks on the current message loop when there is no IO thread. This should only happen in tests scenarios where we only have 1 thread. BUG=6731 TEST=Run the unit-tests. In Chrome, navigate to pages flagged as malware (ex: ianfette.org) and make sure the safe browsing feature still works as expected. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=13088

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 4

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+452 lines, -23 lines) Patch
M chrome/browser/renderer_host/mock_render_process_host.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/safe_browsing/safe_browsing_blocking_page.h View 1 2 3 4 chunks +28 lines, -4 lines 0 comments Download
M chrome/browser/safe_browsing/safe_browsing_blocking_page.cc View 1 2 3 4 chunks +37 lines, -7 lines 0 comments Download
A chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc View 2 3 1 chunk +355 lines, -0 lines 0 comments Download
M chrome/browser/safe_browsing/safe_browsing_service.h View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/safe_browsing/safe_browsing_service.cc View 1 chunk +6 lines, -4 lines 0 comments Download
M chrome/browser/tab_contents/interstitial_page.h View 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/interstitial_page.cc View 1 2 3 2 chunks +10 lines, -5 lines 0 comments Download
M chrome/browser/tab_contents/web_contents_unittest.cc View 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/test/unit/unittests.vcproj View 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
jcampan
11 years, 8 months ago (2009-04-01 17:34:36 UTC) #1
Paul Godavari
LGTM with some comments. Thanks very much for creating these tests! http://codereview.chromium.org/56135/diff/2012/2017 File chrome/browser/safe_browsing/safe_browsing_blocking_page.h (right): ...
11 years, 8 months ago (2009-04-01 22:01:23 UTC) #2
jcampan
11 years, 8 months ago (2009-04-02 07:11:11 UTC) #3
http://codereview.chromium.org/56135/diff/2012/2017
File chrome/browser/safe_browsing/safe_browsing_blocking_page.h (right):

http://codereview.chromium.org/56135/diff/2012/2017#newcode77
Line 77: const UnsafeResourceList& unsafe_resources);
On 2009/04/01 22:01:23, Paul Godavari wrote:
> Maybe make this method protected so it can be used by the sub class and
friends?
I am not following you, it is protected.

http://codereview.chromium.org/56135/diff/2012/2021
File chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
(right):

http://codereview.chromium.org/56135/diff/2012/2021#newcode11
Line 11: static const char* kGoogleURL = "http://www.google.com/";
On 2009/04/01 22:01:23, Paul Godavari wrote:
> I'm not familiar with NavigationController... will these URLs actually get
> loaded? If so, it's probably not a good idea to depend on real URLs that may
or
> may not be available when the test runs. Maybe use testserver.py?
These URLs are arbitrary and are never loaded.
The navigation controller calls on the RVH to load the URL, but in these tests
the RVH is mocked and does not do anything.
So we should be OK.

Powered by Google App Engine
This is Rietveld 408576698