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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" 10 #include "chrome/browser/safe_browsing/browser_feature_extractor.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 SetRedirectChain(redirect_chain); 628 SetRedirectChain(redirect_chain);
629 OnPhishingDetectionDone(verdict.SerializeAsString()); 629 OnPhishingDetectionDone(verdict.SerializeAsString());
630 MessageLoop::current()->Run(); 630 MessageLoop::current()->Run();
631 EXPECT_TRUE(Mock::VerifyAndClear(csd_service_.get())); 631 EXPECT_TRUE(Mock::VerifyAndClear(csd_service_.get()));
632 } 632 }
633 633
634 TEST_F(ClientSideDetectionHostTest, UpdateIPHostMap) { 634 TEST_F(ClientSideDetectionHostTest, UpdateIPHostMap) {
635 BrowseInfo* browse_info = GetBrowseInfo(); 635 BrowseInfo* browse_info = GetBrowseInfo();
636 636
637 // Empty IP or host are skipped 637 // Empty IP or host are skipped
638 UpdateIPHostMap("250.10.10.10", ""); 638 UpdateIPHostMap("250.10.10.10", std::string());
639 ASSERT_EQ(0U, browse_info->ips.size()); 639 ASSERT_EQ(0U, browse_info->ips.size());
640 UpdateIPHostMap("", "google.com/"); 640 UpdateIPHostMap(std::string(), "google.com/");
641 ASSERT_EQ(0U, browse_info->ips.size()); 641 ASSERT_EQ(0U, browse_info->ips.size());
642 UpdateIPHostMap("", ""); 642 UpdateIPHostMap(std::string(), std::string());
643 ASSERT_EQ(0U, browse_info->ips.size()); 643 ASSERT_EQ(0U, browse_info->ips.size());
644 644
645 std::set<std::string> expected_hosts; 645 std::set<std::string> expected_hosts;
646 for (int i = 0; i < 20; i++) { 646 for (int i = 0; i < 20; i++) {
647 std::string host = base::StringPrintf("%d.com/", i); 647 std::string host = base::StringPrintf("%d.com/", i);
648 expected_hosts.insert(host); 648 expected_hosts.insert(host);
649 UpdateIPHostMap("250.10.10.10", host); 649 UpdateIPHostMap("250.10.10.10", host);
650 } 650 }
651 ASSERT_EQ(1U, browse_info->ips.size()); 651 ASSERT_EQ(1U, browse_info->ips.size());
652 ASSERT_EQ(20U, browse_info->ips["250.10.10.10"].size()); 652 ASSERT_EQ(20U, browse_info->ips["250.10.10.10"].size());
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 EXPECT_TRUE(Mock::VerifyAndClear(ui_manager_.get())); 961 EXPECT_TRUE(Mock::VerifyAndClear(ui_manager_.get()));
962 EXPECT_EQ(url, resource.url); 962 EXPECT_EQ(url, resource.url);
963 EXPECT_EQ(url, resource.original_url); 963 EXPECT_EQ(url, resource.original_url);
964 resource.callback.Reset(); 964 resource.callback.Reset();
965 msg = process()->sink().GetFirstMessageMatching( 965 msg = process()->sink().GetFirstMessageMatching(
966 SafeBrowsingMsg_StartPhishingDetection::ID); 966 SafeBrowsingMsg_StartPhishingDetection::ID);
967 ASSERT_FALSE(msg); 967 ASSERT_FALSE(msg);
968 } 968 }
969 969
970 } // namespace safe_browsing 970 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698