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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/scoped_observer.h" | 6 #include "base/scoped_observer.h" |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/extensions/activity_log/activity_actions.h" | 10 #include "chrome/browser/extensions/activity_log/activity_actions.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 injection_type_ = Action::NO_AD_INJECTION; | 86 injection_type_ = Action::NO_AD_INJECTION; |
87 found_multiple_injections_ = false; | 87 found_multiple_injections_ = false; |
88 enabled_ = true; | 88 enabled_ = true; |
89 } | 89 } |
90 | 90 |
91 Action::InjectionType injection_type() const { return injection_type_; } | 91 Action::InjectionType injection_type() const { return injection_type_; } |
92 | 92 |
93 bool found_multiple_injections() const { return found_multiple_injections_; } | 93 bool found_multiple_injections() const { return found_multiple_injections_; } |
94 | 94 |
95 private: | 95 private: |
96 virtual void OnExtensionActivity(scoped_refptr<Action> action) OVERRIDE; | 96 virtual void OnExtensionActivity(scoped_refptr<Action> action) override; |
97 | 97 |
98 ScopedObserver<ActivityLog, ActivityLog::Observer> scoped_observer_; | 98 ScopedObserver<ActivityLog, ActivityLog::Observer> scoped_observer_; |
99 | 99 |
100 // The associated BrowserContext. | 100 // The associated BrowserContext. |
101 content::BrowserContext* context_; | 101 content::BrowserContext* context_; |
102 | 102 |
103 // The type of the last injection. | 103 // The type of the last injection. |
104 Action::InjectionType injection_type_; | 104 Action::InjectionType injection_type_; |
105 | 105 |
106 // Whether or not we found multiple injection types (which shouldn't happen). | 106 // Whether or not we found multiple injection types (which shouldn't happen). |
(...skipping 28 matching lines...) Expand all Loading... |
135 } | 135 } |
136 | 136 |
137 // A mock for the AdNetworkDatabase. This simply says that the URL | 137 // A mock for the AdNetworkDatabase. This simply says that the URL |
138 // http://www.known-ads.adnetwork is an ad network, and nothing else is. | 138 // http://www.known-ads.adnetwork is an ad network, and nothing else is. |
139 class TestAdNetworkDatabase : public AdNetworkDatabase { | 139 class TestAdNetworkDatabase : public AdNetworkDatabase { |
140 public: | 140 public: |
141 TestAdNetworkDatabase(); | 141 TestAdNetworkDatabase(); |
142 virtual ~TestAdNetworkDatabase(); | 142 virtual ~TestAdNetworkDatabase(); |
143 | 143 |
144 private: | 144 private: |
145 virtual bool IsAdNetwork(const GURL& url) const OVERRIDE; | 145 virtual bool IsAdNetwork(const GURL& url) const override; |
146 | 146 |
147 GURL ad_network_url1_; | 147 GURL ad_network_url1_; |
148 GURL ad_network_url2_; | 148 GURL ad_network_url2_; |
149 }; | 149 }; |
150 | 150 |
151 TestAdNetworkDatabase::TestAdNetworkDatabase() : ad_network_url1_(kAdNetwork1), | 151 TestAdNetworkDatabase::TestAdNetworkDatabase() : ad_network_url1_(kAdNetwork1), |
152 ad_network_url2_(kAdNetwork2) { | 152 ad_network_url2_(kAdNetwork2) { |
153 } | 153 } |
154 | 154 |
155 TestAdNetworkDatabase::~TestAdNetworkDatabase() {} | 155 TestAdNetworkDatabase::~TestAdNetworkDatabase() {} |
(...skipping 10 matching lines...) Expand all Loading... |
166 return response.PassAs<net::test_server::HttpResponse>(); | 166 return response.PassAs<net::test_server::HttpResponse>(); |
167 } | 167 } |
168 | 168 |
169 } // namespace | 169 } // namespace |
170 | 170 |
171 class AdInjectionBrowserTest : public ExtensionBrowserTest { | 171 class AdInjectionBrowserTest : public ExtensionBrowserTest { |
172 protected: | 172 protected: |
173 AdInjectionBrowserTest(); | 173 AdInjectionBrowserTest(); |
174 virtual ~AdInjectionBrowserTest(); | 174 virtual ~AdInjectionBrowserTest(); |
175 | 175 |
176 virtual void SetUpOnMainThread() OVERRIDE; | 176 virtual void SetUpOnMainThread() override; |
177 virtual void TearDownOnMainThread() OVERRIDE; | 177 virtual void TearDownOnMainThread() override; |
178 | 178 |
179 // Handle the "Reset Begin" stage of the test. | 179 // Handle the "Reset Begin" stage of the test. |
180 testing::AssertionResult HandleResetBeginStage(); | 180 testing::AssertionResult HandleResetBeginStage(); |
181 | 181 |
182 // Handle the "Reset End" stage of the test. | 182 // Handle the "Reset End" stage of the test. |
183 testing::AssertionResult HandleResetEndStage(); | 183 testing::AssertionResult HandleResetEndStage(); |
184 | 184 |
185 // Handle the "Testing" stage of the test. | 185 // Handle the "Testing" stage of the test. |
186 testing::AssertionResult HandleTestingStage(const std::string& message); | 186 testing::AssertionResult HandleTestingStage(const std::string& message); |
187 | 187 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 listener()->Reply("Continue"); | 380 listener()->Reply("Continue"); |
381 listener()->Reset(); | 381 listener()->Reset(); |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 // TODO(rdevlin.cronin): We test a good amount of ways of injecting ads with | 385 // TODO(rdevlin.cronin): We test a good amount of ways of injecting ads with |
386 // the above test, but more is better in testing. | 386 // the above test, but more is better in testing. |
387 // See crbug.com/357204. | 387 // See crbug.com/357204. |
388 | 388 |
389 } // namespace extensions | 389 } // namespace extensions |
OLD | NEW |