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

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 11615011: Small modifications to safebrowsing code to make it simpler to add the extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compiler Created 7 years, 11 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 | Annotate | Revision Log
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 <deque> 5 #include <deque>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/test/test_timeouts.h" 11 #include "base/test/test_timeouts.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browsing_data/browsing_data_helper.h" 14 #include "chrome/browser/browsing_data/browsing_data_helper.h"
15 #include "chrome/browser/browsing_data/browsing_data_remover.h" 15 #include "chrome/browser/browsing_data/browsing_data_remover.h"
16 #include "chrome/browser/content_settings/host_content_settings_map.h" 16 #include "chrome/browser/content_settings/host_content_settings_map.h"
17 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" 17 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
18 #include "chrome/browser/extensions/extension_apitest.h" 18 #include "chrome/browser/extensions/extension_apitest.h"
19 #include "chrome/browser/favicon/favicon_tab_helper.h" 19 #include "chrome/browser/favicon/favicon_tab_helper.h"
20 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/browser/prerender/prerender_contents.h" 21 #include "chrome/browser/prerender/prerender_contents.h"
22 #include "chrome/browser/prerender/prerender_handle.h" 22 #include "chrome/browser/prerender/prerender_handle.h"
23 #include "chrome/browser/prerender/prerender_link_manager.h" 23 #include "chrome/browser/prerender/prerender_link_manager.h"
24 #include "chrome/browser/prerender/prerender_link_manager_factory.h" 24 #include "chrome/browser/prerender/prerender_link_manager_factory.h"
25 #include "chrome/browser/prerender/prerender_manager.h" 25 #include "chrome/browser/prerender/prerender_manager.h"
26 #include "chrome/browser/prerender/prerender_manager_factory.h" 26 #include "chrome/browser/prerender/prerender_manager_factory.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/safe_browsing/database_manager.h" 28 #include "chrome/browser/safe_browsing/database_manager.h"
29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
30 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
30 #include "chrome/browser/task_manager/task_manager.h" 31 #include "chrome/browser/task_manager/task_manager.h"
31 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" 32 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
32 #include "chrome/browser/ui/browser.h" 33 #include "chrome/browser/ui/browser.h"
33 #include "chrome/browser/ui/browser_commands.h" 34 #include "chrome/browser/ui/browser_commands.h"
34 #include "chrome/browser/ui/browser_finder.h" 35 #include "chrome/browser/ui/browser_finder.h"
35 #include "chrome/browser/ui/browser_tabstrip.h" 36 #include "chrome/browser/ui/browser_tabstrip.h"
36 #include "chrome/browser/ui/browser_window.h" 37 #include "chrome/browser/ui/browser_window.h"
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" 38 #include "chrome/browser/ui/tabs/tab_strip_model.h"
38 #include "chrome/common/chrome_notification_types.h" 39 #include "chrome/common/chrome_notification_types.h"
39 #include "chrome/common/chrome_paths.h" 40 #include "chrome/common/chrome_paths.h"
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 493
493 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) { 494 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) {
494 url_ = url; 495 url_ = url;
495 threat_type_ = threat_type; 496 threat_type_ = threat_type;
496 } 497 }
497 498
498 private: 499 private:
499 virtual ~FakeSafeBrowsingDatabaseManager() {} 500 virtual ~FakeSafeBrowsingDatabaseManager() {}
500 501
501 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { 502 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) {
502 SafeBrowsingDatabaseManager::SafeBrowsingCheck check; 503 SafeBrowsingDatabaseManager::SafeBrowsingCheck check(
504 safe_browsing_util::MALWARE);
503 check.urls.push_back(gurl); 505 check.urls.push_back(gurl);
504 check.client = client; 506 check.client = client;
505 check.threat_type = threat_type_; 507 check.url_threats[gurl] = threat_type_;
506 client->OnSafeBrowsingResult(check); 508 client->OnSafeBrowsingResult(check);
507 } 509 }
508 510
509 GURL url_; 511 GURL url_;
510 SBThreatType threat_type_; 512 SBThreatType threat_type_;
511 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); 513 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager);
512 }; 514 };
513 515
514 class FakeSafeBrowsingService : public SafeBrowsingService { 516 class FakeSafeBrowsingService : public SafeBrowsingService {
515 public: 517 public:
(...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 channel_close_watcher.WatchChannel( 2711 channel_close_watcher.WatchChannel(
2710 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); 2712 chrome::GetActiveWebContents(browser())->GetRenderProcessHost());
2711 NavigateToDestURL(); 2713 NavigateToDestURL();
2712 channel_close_watcher.WaitForChannelClose(); 2714 channel_close_watcher.WaitForChannelClose();
2713 2715
2714 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); 2716 ASSERT_TRUE(IsEmptyPrerenderLinkManager());
2715 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 2717 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
2716 } 2718 }
2717 2719
2718 } // namespace prerender 2720 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/database_manager.h » ('j') | chrome/browser/safe_browsing/database_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698