| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/browser/extensions/activity_log/hashed_ad_network_database.h" | 10 #include "chrome/browser/extensions/activity_log/hashed_ad_network_database.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 "charlie.delta.adnetwork" | 23 "charlie.delta.adnetwork" |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 // The number of ad networks for these tests. | 26 // The number of ad networks for these tests. |
| 27 const size_t kNumAdNetworkHosts = arraysize(kAdNetworkHosts); | 27 const size_t kNumAdNetworkHosts = arraysize(kAdNetworkHosts); |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 class HashedAdNetworkDatabaseUnitTest : public testing::Test { | 31 class HashedAdNetworkDatabaseUnitTest : public testing::Test { |
| 32 protected: | 32 protected: |
| 33 virtual void SetUp() OVERRIDE; | 33 virtual void SetUp() override; |
| 34 | 34 |
| 35 AdNetworkDatabase* database() { return database_.get(); } | 35 AdNetworkDatabase* database() { return database_.get(); } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 void GenerateHashes(); | 38 void GenerateHashes(); |
| 39 | 39 |
| 40 // The fake hashes for the ad networks. | 40 // The fake hashes for the ad networks. |
| 41 const char* ad_networks_[kNumAdNetworkHosts]; | 41 const char* ad_networks_[kNumAdNetworkHosts]; |
| 42 | 42 |
| 43 // The backing data for the ad networks. Since everything expects a const | 43 // The backing data for the ad networks. Since everything expects a const |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // inserted a fake URL in the used dataset for testing purposes. | 107 // inserted a fake URL in the used dataset for testing purposes. |
| 108 TEST(HashedAdNetworkDatabaseUnitTest2, RealFile) { | 108 TEST(HashedAdNetworkDatabaseUnitTest2, RealFile) { |
| 109 HashedAdNetworkDatabase database; | 109 HashedAdNetworkDatabase database; |
| 110 AdNetworkDatabase* db = static_cast<AdNetworkDatabase*>(&database); | 110 AdNetworkDatabase* db = static_cast<AdNetworkDatabase*>(&database); |
| 111 EXPECT_TRUE(db->IsAdNetwork( | 111 EXPECT_TRUE(db->IsAdNetwork( |
| 112 GURL("http://definitely.surely.always.an.adnetwork"))); | 112 GURL("http://definitely.surely.always.an.adnetwork"))); |
| 113 EXPECT_FALSE(db->IsAdNetwork(GURL("http://definitely.not.one"))); | 113 EXPECT_FALSE(db->IsAdNetwork(GURL("http://definitely.not.one"))); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace extensions | 116 } // namespace extensions |
| OLD | NEW |