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

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

Issue 10790035: Removing usage of profile_->GetHistory() from the codebase in order to remove that function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 "chrome/browser/safe_browsing/browser_feature_extractor.h" 5 #include "chrome/browser/safe_browsing/browser_feature_extractor.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "chrome/browser/history/history.h" 15 #include "chrome/browser/history/history.h"
16 #include "chrome/browser/history/history_backend.h" 16 #include "chrome/browser/history/history_backend.h"
17 #include "chrome/browser/history/history_service_factory.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/safe_browsing/browser_features.h" 19 #include "chrome/browser/safe_browsing/browser_features.h"
19 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 20 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
20 #include "chrome/common/safe_browsing/csd.pb.h" 21 #include "chrome/common/safe_browsing/csd.pb.h"
21 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
22 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
23 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
24 #include "content/public/common/page_transition_types.h" 25 #include "content/public/common/page_transition_types.h"
25 #include "content/public/common/referrer.h" 26 #include "content/public/common/referrer.h"
26 #include "content/public/browser/navigation_controller.h" 27 #include "content/public/browser/navigation_controller.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 63 }
63 64
64 virtual void TearDown() { 65 virtual void TearDown() {
65 extractor_.reset(); 66 extractor_.reset();
66 profile()->DestroyHistoryService(); 67 profile()->DestroyHistoryService();
67 ChromeRenderViewHostTestHarness::TearDown(); 68 ChromeRenderViewHostTestHarness::TearDown();
68 ASSERT_EQ(0, num_pending_); 69 ASSERT_EQ(0, num_pending_);
69 } 70 }
70 71
71 HistoryService* history_service() { 72 HistoryService* history_service() {
72 return profile()->GetHistoryService(Profile::EXPLICIT_ACCESS); 73 return HistoryServiceFactory::GetForProfile(profile(),
74 Profile::EXPLICIT_ACCESS);
73 } 75 }
74 76
75 void SetRedirectChain(const std::vector<GURL>& redirect_chain, 77 void SetRedirectChain(const std::vector<GURL>& redirect_chain,
76 bool new_host) { 78 bool new_host) {
77 browse_info_->url_redirects = redirect_chain; 79 browse_info_->url_redirects = redirect_chain;
78 if (new_host) { 80 if (new_host) {
79 browse_info_->host_redirects = redirect_chain; 81 browse_info_->host_redirects = redirect_chain;
80 } 82 }
81 } 83 }
82 84
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 EXPECT_TRUE(features.count(StringPrintf("%s%s", 501 EXPECT_TRUE(features.count(StringPrintf("%s%s",
500 features::kSafeBrowsingMaliciousUrl, 502 features::kSafeBrowsingMaliciousUrl,
501 "http://www.malware.com/"))); 503 "http://www.malware.com/")));
502 EXPECT_TRUE(features.count(StringPrintf("%s%s", 504 EXPECT_TRUE(features.count(StringPrintf("%s%s",
503 features::kSafeBrowsingOriginalUrl, 505 features::kSafeBrowsingOriginalUrl,
504 "http://www.good.com/"))); 506 "http://www.good.com/")));
505 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); 507 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]);
506 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); 508 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]);
507 } 509 }
508 } // namespace safe_browsing 510 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/browser_feature_extractor.cc ('k') | chrome/browser/safe_browsing/malware_details_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698