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

Unified Diff: chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc

Issue 7746011: Revert 98168, it caused compile errors on mac: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
===================================================================
--- chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc (revision 98169)
+++ chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc (working copy)
@@ -15,7 +15,6 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/safe_browsing/browser_features.h"
#include "chrome/browser/safe_browsing/client_side_detection_service.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
@@ -24,7 +23,6 @@
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/page_transition_types.h"
#include "content/common/view_messages.h"
-#include "crypto/sha2.h"
#include "googleurl/src/gurl.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -476,52 +474,4 @@
EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]);
EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]);
}
-
-TEST_F(BrowserFeatureExtractorTest, URLHashes) {
- ClientPhishingRequest request;
- request.set_url("http://host.com/");
- request.set_client_score(0.8f);
-
- history_service()->AddPage(GURL("http://host.com/"),
- history::SOURCE_BROWSED);
- contents()->NavigateAndCommit(GURL("http://host.com/"));
-
- EXPECT_TRUE(ExtractFeatures(&request));
- EXPECT_EQ(crypto::SHA256HashString("host.com/").substr(
- 0, BrowserFeatureExtractor::kSuffixPrefixHashLength),
- request.suffix_prefix_hash());
-
- request.set_url("http://www.host.com/path/");
- history_service()->AddPage(GURL("http://www.host.com/path/"),
- history::SOURCE_BROWSED);
- contents()->NavigateAndCommit(GURL("http://www.host.com/path/"));
-
- EXPECT_TRUE(ExtractFeatures(&request));
- EXPECT_EQ(crypto::SHA256HashString("www.host.com/path/").substr(
- 0, BrowserFeatureExtractor::kSuffixPrefixHashLength),
- request.suffix_prefix_hash());
-
- request.set_url("http://user@www.host.com:1111/path/123?args");
- history_service()->AddPage(
- GURL("http://user@www.host.com:1111/path/123?args"),
- history::SOURCE_BROWSED);
- contents()->NavigateAndCommit(
- GURL("http://user@www.host.com:1111/path/123?args"));
-
- EXPECT_TRUE(ExtractFeatures(&request));
- EXPECT_EQ(crypto::SHA256HashString("www.host.com/path/123").substr(
- 0, BrowserFeatureExtractor::kSuffixPrefixHashLength),
- request.suffix_prefix_hash());
-
- // Check that escaping matches the SafeBrowsing specification.
- request.set_url("http://www.host.com/A%21//B");
- history_service()->AddPage(GURL("http://www.host.com/A%21//B"),
- history::SOURCE_BROWSED);
- contents()->NavigateAndCommit(GURL("http://www.host.com/A%21//B"));
-
- EXPECT_TRUE(ExtractFeatures(&request));
- EXPECT_EQ(crypto::SHA256HashString("www.host.com/A!/B").substr(
- 0, BrowserFeatureExtractor::kSuffixPrefixHashLength),
- request.suffix_prefix_hash());
-}
} // namespace safe_browsing
« no previous file with comments | « chrome/browser/safe_browsing/browser_feature_extractor.cc ('k') | chrome/browser/safe_browsing/browser_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698