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

Side by Side Diff: chrome/browser/net/evicted_domain_cookie_counter_unittest.cc

Issue 233353003: Only commit cookie changes in prerenders after a prerender is shown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add browser tests, fix a bug in what was changed yesterday. Created 6 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 class ChangedDelegateDummy : public net::CookieMonster::Delegate { 186 class ChangedDelegateDummy : public net::CookieMonster::Delegate {
187 public: 187 public:
188 explicit ChangedDelegateDummy(int* result) : result_(result) {} 188 explicit ChangedDelegateDummy(int* result) : result_(result) {}
189 189
190 virtual void OnCookieChanged(const net::CanonicalCookie& cookie, 190 virtual void OnCookieChanged(const net::CanonicalCookie& cookie,
191 bool removed, 191 bool removed,
192 ChangeCause cause) OVERRIDE { 192 ChangeCause cause) OVERRIDE {
193 ++(*result_); 193 ++(*result_);
194 } 194 }
195 195
196 virtual void OnLoaded() OVERRIDE {}
197
196 private: 198 private:
197 virtual ~ChangedDelegateDummy() {} 199 virtual ~ChangedDelegateDummy() {}
198 200
199 int* result_; 201 int* result_;
200 }; 202 };
201 203
202 scoped_ptr<MockDelegate> cookie_counter_delegate(new MockDelegate(this)); 204 scoped_ptr<MockDelegate> cookie_counter_delegate(new MockDelegate(this));
203 cookie_counter_ = new EvictedDomainCookieCounter( 205 cookie_counter_ = new EvictedDomainCookieCounter(
204 new ChangedDelegateDummy(&result), 206 new ChangedDelegateDummy(&result),
205 cookie_counter_delegate.PassAs<EvictedDomainCookieCounter::Delegate>(), 207 cookie_counter_delegate.PassAs<EvictedDomainCookieCounter::Delegate>(),
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 for (int i = 0; i < 6; ++i) 382 for (int i = 0; i < 6; ++i)
381 Add(cookies_[i]); 383 Add(cookies_[i]);
382 EXPECT_EQ(0u, cookie_counter_->GetStorageSize()); 384 EXPECT_EQ(0u, cookie_counter_->GetStorageSize());
383 // Reinstatement delays: [1499,1497,(1494),(1490),(1485),300]. 385 // Reinstatement delays: [1499,1497,(1494),(1490),(1485),300].
384 EXPECT_EQ("1499,1497;300", google_stat_ + ";" + other_stat_); 386 EXPECT_EQ("1499,1497;300", google_stat_ + ";" + other_stat_);
385 } 387 }
386 388
387 } // namespace 389 } // namespace
388 390
389 } // namespace chrome_browser_net 391 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698