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" |
11 #include "crypto/sha2.h" | 11 #include "crypto/sha2.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // A list of fake ad networks. | 19 // A list of fake ad networks. |
20 const char* kAdNetworkHosts[] = { | 20 const char* const kAdNetworkHosts[] = { |
21 "alpha.adnetwork", | 21 "alpha.adnetwork", |
22 "bravo.adnetwork", | 22 "bravo.adnetwork", |
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 |
(...skipping 76 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 |