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

Unified Diff: components/safe_browsing/base_ping_manager_unittest.cc

Issue 2650973005: Componentize ping_manager (Closed)
Patch Set: fix deps Created 3 years, 10 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: components/safe_browsing/base_ping_manager_unittest.cc
diff --git a/chrome/browser/safe_browsing/ping_manager_unittest.cc b/components/safe_browsing/base_ping_manager_unittest.cc
similarity index 94%
rename from chrome/browser/safe_browsing/ping_manager_unittest.cc
rename to components/safe_browsing/base_ping_manager_unittest.cc
index ecae781840865e7011238ab572822ea1eef14b73..545ae5b9f4eb36b684a8e9204aab2e52da40e70e 100644
--- a/chrome/browser/safe_browsing/ping_manager_unittest.cc
+++ b/components/safe_browsing/base_ping_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -9,7 +9,7 @@
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/values.h"
-#include "chrome/browser/safe_browsing/ping_manager.h"
+#include "components/safe_browsing/base_ping_manager.h"
#include "google_apis/google_api_keys.h"
#include "net/base/escape.h"
#include "net/log/net_log.h"
@@ -31,9 +31,9 @@ static const char kAppVer[] = "1.0";
namespace safe_browsing {
-class SafeBrowsingPingManagerTest : public testing::Test {
+class BasePingManagerTest : public testing::Test {
public:
- SafeBrowsingPingManagerTest()
+ BasePingManagerTest()
: net_log_(new net::TestNetLog()) {
net_log_with_source_ = net::NetLogWithSource::Make(
net_log_.get(), net::NetLogSourceType::SAFE_BROWSING);
@@ -51,12 +51,12 @@ class SafeBrowsingPingManagerTest : public testing::Test {
SafeBrowsingProtocolConfig config;
config.client_name = kClient;
config.url_prefix = kUrlPrefix;
- ping_manager_.reset(new SafeBrowsingPingManager(NULL, config));
+ ping_manager_.reset(new BasePingManager(NULL, config));
ping_manager_->version_ = kAppVer;
ping_manager_->net_log_ = net_log_with_source_;
}
- SafeBrowsingPingManager* ping_manager() {
+ BasePingManager* ping_manager() {
return ping_manager_.get();
}
@@ -64,10 +64,10 @@ class SafeBrowsingPingManagerTest : public testing::Test {
std::unique_ptr<net::TestNetLog> net_log_;
net::NetLogWithSource net_log_with_source_;
net::TestURLFetcherFactory fetcher_factory_;
- std::unique_ptr<SafeBrowsingPingManager> ping_manager_;
+ std::unique_ptr<BasePingManager> ping_manager_;
};
-TEST_F(SafeBrowsingPingManagerTest, TestSafeBrowsingHitUrl) {
+TEST_F(BasePingManagerTest, TestSafeBrowsingHitUrl) {
HitReport base_hp;
base_hp.malicious_url = GURL("http://malicious.url.com");
base_hp.page_url = GURL("http://page.url.com");
@@ -202,13 +202,13 @@ TEST_F(SafeBrowsingPingManagerTest, TestSafeBrowsingHitUrl) {
}
}
-TEST_F(SafeBrowsingPingManagerTest, TestThreatDetailsUrl) {
+TEST_F(BasePingManagerTest, TestThreatDetailsUrl) {
EXPECT_EQ("https://prefix.com/foo/clientreport/malware?"
"client=unittest&appver=1.0&pver=1.0" + key_param_,
ping_manager()->ThreatDetailsUrl().spec());
}
-TEST_F(SafeBrowsingPingManagerTest, TestReportThreatDetails) {
+TEST_F(BasePingManagerTest, TestReportThreatDetails) {
const std::string kThreatDetailsReportString = "Threat Details Report String";
std::string encoded_threat_report = "";
base::Base64Encode(kThreatDetailsReportString, &encoded_threat_report);
@@ -263,7 +263,7 @@ TEST_F(SafeBrowsingPingManagerTest, TestReportThreatDetails) {
EXPECT_TRUE(end_entry.params->HasKey("source_dependency"));
}
-TEST_F(SafeBrowsingPingManagerTest, TestReportSafeBrowsingHit) {
+TEST_F(BasePingManagerTest, TestReportSafeBrowsingHit) {
const std::string kHitReportPostData = "Hit Report POST Data";
std::string encoded_post_data = "";
base::Base64Encode(kHitReportPostData, &encoded_post_data);

Powered by Google App Engine
This is Rietveld 408576698