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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc

Issue 2225113002: Reland: Move PVer4 related code from util.* to v4_protocol_manager_util.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor: Address nparker@'s comments Created 4 years, 4 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 // This test creates a safebrowsing service using test safebrowsing database 5 // This test creates a safebrowsing service using test safebrowsing database
6 // and a test protocol manager. It is used to test logics in safebrowsing 6 // and a test protocol manager. It is used to test logics in safebrowsing
7 // service. 7 // service.
8 8
9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
48 #include "chrome/test/base/in_process_browser_test.h" 48 #include "chrome/test/base/in_process_browser_test.h"
49 #include "chrome/test/base/ui_test_utils.h" 49 #include "chrome/test/base/ui_test_utils.h"
50 #include "components/bookmarks/browser/startup_task_runner_service.h" 50 #include "components/bookmarks/browser/startup_task_runner_service.h"
51 #include "components/content_settings/core/browser/host_content_settings_map.h" 51 #include "components/content_settings/core/browser/host_content_settings_map.h"
52 #include "components/prefs/pref_service.h" 52 #include "components/prefs/pref_service.h"
53 #include "components/safe_browsing_db/database_manager.h" 53 #include "components/safe_browsing_db/database_manager.h"
54 #include "components/safe_browsing_db/metadata.pb.h" 54 #include "components/safe_browsing_db/metadata.pb.h"
55 #include "components/safe_browsing_db/test_database_manager.h" 55 #include "components/safe_browsing_db/test_database_manager.h"
56 #include "components/safe_browsing_db/util.h" 56 #include "components/safe_browsing_db/util.h"
57 #include "components/safe_browsing_db/v4_protocol_manager_util.h"
57 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" 58 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h"
58 #include "content/public/browser/interstitial_page.h" 59 #include "content/public/browser/interstitial_page.h"
59 #include "content/public/browser/navigation_entry.h" 60 #include "content/public/browser/navigation_entry.h"
60 #include "content/public/browser/render_frame_host.h" 61 #include "content/public/browser/render_frame_host.h"
61 #include "content/public/browser/web_contents.h" 62 #include "content/public/browser/web_contents.h"
62 #include "content/public/test/browser_test_utils.h" 63 #include "content/public/test/browser_test_utils.h"
63 #include "net/cookies/cookie_store.h" 64 #include "net/cookies/cookie_store.h"
64 #include "net/cookies/cookie_util.h" 65 #include "net/cookies/cookie_util.h"
65 #include "net/test/embedded_test_server/embedded_test_server.h" 66 #include "net/test/embedded_test_server/embedded_test_server.h"
66 #include "net/test/embedded_test_server/http_request.h" 67 #include "net/test/embedded_test_server/http_request.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 // Tests the safe browsing blocking page in a browser. 478 // Tests the safe browsing blocking page in a browser.
478 class SafeBrowsingServiceTest : public InProcessBrowserTest { 479 class SafeBrowsingServiceTest : public InProcessBrowserTest {
479 public: 480 public:
480 SafeBrowsingServiceTest() {} 481 SafeBrowsingServiceTest() {}
481 482
482 static void GenUrlFullHashResult(const GURL& url, 483 static void GenUrlFullHashResult(const GURL& url,
483 int list_id, 484 int list_id,
484 SBFullHashResult* full_hash) { 485 SBFullHashResult* full_hash) {
485 std::string host; 486 std::string host;
486 std::string path; 487 std::string path;
487 CanonicalizeUrl(url, &host, &path, nullptr); 488 V4ProtocolManagerUtil::CanonicalizeUrl(url, &host, &path, nullptr);
488 full_hash->hash = SBFullHashForString(host + path); 489 full_hash->hash = SBFullHashForString(host + path);
489 full_hash->list_id = list_id; 490 full_hash->list_id = list_id;
490 } 491 }
491 492
492 static void GenUrlFullHashResultWithMetadata(const GURL& url, 493 static void GenUrlFullHashResultWithMetadata(const GURL& url,
493 int list_id, 494 int list_id,
494 ThreatPatternType threat, 495 ThreatPatternType threat,
495 SBFullHashResult* full_hash) { 496 SBFullHashResult* full_hash) {
496 GenUrlFullHashResult(url, list_id, full_hash); 497 GenUrlFullHashResult(url, list_id, full_hash);
497 full_hash->metadata.threat_pattern_type = threat; 498 full_hash->metadata.threat_pattern_type = threat;
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 content::Source<SafeBrowsingDatabaseManager>( 1757 content::Source<SafeBrowsingDatabaseManager>(
1757 sb_factory_->test_safe_browsing_service()->database_manager().get())); 1758 sb_factory_->test_safe_browsing_service()->database_manager().get()));
1758 BrowserThread::PostTask( 1759 BrowserThread::PostTask(
1759 BrowserThread::IO, FROM_HERE, 1760 BrowserThread::IO, FROM_HERE,
1760 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, 1761 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate,
1761 base::Unretained(this))); 1762 base::Unretained(this)));
1762 observer.Wait(); 1763 observer.Wait();
1763 } 1764 }
1764 1765
1765 } // namespace safe_browsing 1766 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/local_database_manager.cc ('k') | components/safe_browsing_db/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698