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

Side by Side Diff: net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc

Issue 1016643004: Moves SQLitePersistentCookieStore to net/extras/sqlite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cookies
Patch Set: Review. Created 5 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
« no previous file with comments | « net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/net/sqlite_persistent_cookie_store.h" 5 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/location.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/message_loop/message_loop.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
19 #include "base/test/sequenced_worker_pool_owner.h" 19 #include "base/test/sequenced_worker_pool_owner.h"
20 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "content/public/browser/cookie_store_factory.h"
23 #include "crypto/encryptor.h" 22 #include "crypto/encryptor.h"
24 #include "crypto/symmetric_key.h" 23 #include "crypto/symmetric_key.h"
25 #include "net/cookies/canonical_cookie.h" 24 #include "net/cookies/canonical_cookie.h"
26 #include "net/cookies/cookie_constants.h" 25 #include "net/cookies/cookie_constants.h"
27 #include "net/extras/sqlite/cookie_crypto_delegate.h" 26 #include "net/extras/sqlite/cookie_crypto_delegate.h"
28 #include "sql/connection.h" 27 #include "sql/connection.h"
29 #include "sql/meta_table.h" 28 #include "sql/meta_table.h"
30 #include "sql/statement.h" 29 #include "sql/statement.h"
31 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
32 #include "url/gurl.h" 31 #include "url/gurl.h"
33 32
34 namespace content { 33 namespace net {
35 34
36 namespace { 35 namespace {
37 36
38 const base::FilePath::CharType kCookieFilename[] = FILE_PATH_LITERAL("Cookies"); 37 const base::FilePath::CharType kCookieFilename[] = FILE_PATH_LITERAL("Cookies");
39 38
40 class CookieCryptor : public net::CookieCryptoDelegate { 39 class CookieCryptor : public CookieCryptoDelegate {
41 public: 40 public:
42 CookieCryptor(); 41 CookieCryptor();
43 bool EncryptString(const std::string& plaintext, 42 bool EncryptString(const std::string& plaintext,
44 std::string* ciphertext) override; 43 std::string* ciphertext) override;
45 bool DecryptString(const std::string& ciphertext, 44 bool DecryptString(const std::string& ciphertext,
46 std::string* plaintext) override; 45 std::string* plaintext) override;
47 46
48 private: 47 private:
49 scoped_ptr<crypto::SymmetricKey> key_; 48 scoped_ptr<crypto::SymmetricKey> key_;
50 crypto::Encryptor encryptor_; 49 crypto::Encryptor encryptor_;
51 }; 50 };
52 51
53 CookieCryptor::CookieCryptor() : key_( 52 CookieCryptor::CookieCryptor()
54 crypto::SymmetricKey::DeriveKeyFromPassword( 53 : key_(
55 crypto::SymmetricKey::AES, "password", "saltiest", 1000, 256)) { 54 crypto::SymmetricKey::DeriveKeyFromPassword(crypto::SymmetricKey::AES,
55 "password",
56 "saltiest",
57 1000,
58 256)) {
56 std::string iv("the iv: 16 bytes"); 59 std::string iv("the iv: 16 bytes");
57 encryptor_.Init(key_.get(), crypto::Encryptor::CBC, iv); 60 encryptor_.Init(key_.get(), crypto::Encryptor::CBC, iv);
58 } 61 }
59 62
60 bool CookieCryptor::EncryptString(const std::string& plaintext, 63 bool CookieCryptor::EncryptString(const std::string& plaintext,
61 std::string* ciphertext) { 64 std::string* ciphertext) {
62 return encryptor_.Encrypt(plaintext, ciphertext); 65 return encryptor_.Encrypt(plaintext, ciphertext);
63 } 66 }
64 67
65 bool CookieCryptor::DecryptString(const std::string& ciphertext, 68 bool CookieCryptor::DecryptString(const std::string& ciphertext,
66 std::string* plaintext) { 69 std::string* plaintext) {
67 return encryptor_.Decrypt(ciphertext, plaintext); 70 return encryptor_.Decrypt(ciphertext, plaintext);
68 } 71 }
69 72
70 } // namespace 73 } // namespace
71 74
72 typedef std::vector<net::CanonicalCookie*> CanonicalCookieVector; 75 typedef std::vector<CanonicalCookie*> CanonicalCookieVector;
73 76
74 class SQLitePersistentCookieStoreTest : public testing::Test { 77 class SQLitePersistentCookieStoreTest : public testing::Test {
75 public: 78 public:
76 SQLitePersistentCookieStoreTest() 79 SQLitePersistentCookieStoreTest()
77 : pool_owner_(new base::SequencedWorkerPoolOwner(3, "Background Pool")), 80 : pool_owner_(new base::SequencedWorkerPoolOwner(3, "Background Pool")),
78 loaded_event_(false, false), 81 loaded_event_(false, false),
79 key_loaded_event_(false, false), 82 key_loaded_event_(false, false),
80 db_thread_event_(false, false) { 83 db_thread_event_(false, false) {}
81 }
82 84
83 void OnLoaded(const CanonicalCookieVector& cookies) { 85 void OnLoaded(const CanonicalCookieVector& cookies) {
84 cookies_ = cookies; 86 cookies_ = cookies;
85 loaded_event_.Signal(); 87 loaded_event_.Signal();
86 } 88 }
87 89
88 void OnKeyLoaded(const CanonicalCookieVector& cookies) { 90 void OnKeyLoaded(const CanonicalCookieVector& cookies) {
89 cookies_ = cookies; 91 cookies_ = cookies;
90 key_loaded_event_.Signal(); 92 key_loaded_event_.Signal();
91 } 93 }
92 94
93 void Load(CanonicalCookieVector* cookies) { 95 void Load(CanonicalCookieVector* cookies) {
94 EXPECT_FALSE(loaded_event_.IsSignaled()); 96 EXPECT_FALSE(loaded_event_.IsSignaled());
95 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded, 97 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded,
96 base::Unretained(this))); 98 base::Unretained(this)));
97 loaded_event_.Wait(); 99 loaded_event_.Wait();
98 *cookies = cookies_; 100 *cookies = cookies_;
99 } 101 }
100 102
101 void Flush() { 103 void Flush() {
102 base::WaitableEvent event(false, false); 104 base::WaitableEvent event(false, false);
103 store_->Flush(base::Bind(&base::WaitableEvent::Signal, 105 store_->Flush(
104 base::Unretained(&event))); 106 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)));
105 event.Wait(); 107 event.Wait();
106 } 108 }
107 109
108 scoped_refptr<base::SequencedTaskRunner> background_task_runner() { 110 scoped_refptr<base::SequencedTaskRunner> background_task_runner() {
109 return pool_owner_->pool()->GetSequencedTaskRunner( 111 return pool_owner_->pool()->GetSequencedTaskRunner(
110 pool_owner_->pool()->GetNamedSequenceToken("background")); 112 pool_owner_->pool()->GetNamedSequenceToken("background"));
111 } 113 }
112 114
113 scoped_refptr<base::SequencedTaskRunner> client_task_runner() { 115 scoped_refptr<base::SequencedTaskRunner> client_task_runner() {
114 return pool_owner_->pool()->GetSequencedTaskRunner( 116 return pool_owner_->pool()->GetSequencedTaskRunner(
115 pool_owner_->pool()->GetNamedSequenceToken("client")); 117 pool_owner_->pool()->GetNamedSequenceToken("client"));
116 } 118 }
117 119
118 void DestroyStore() { 120 void DestroyStore() {
119 store_ = NULL; 121 store_ = nullptr;
120 // Make sure we wait until the destructor has run by shutting down the pool 122 // Make sure we wait until the destructor has run by shutting down the pool
121 // resetting the owner (whose destructor blocks on the pool completion). 123 // resetting the owner (whose destructor blocks on the pool completion).
122 pool_owner_->pool()->Shutdown(); 124 pool_owner_->pool()->Shutdown();
123 // Create a new pool for the few tests that create multiple stores. In other 125 // Create a new pool for the few tests that create multiple stores. In other
124 // cases this is wasted but harmless. 126 // cases this is wasted but harmless.
125 pool_owner_.reset(new base::SequencedWorkerPoolOwner(3, "Background Pool")); 127 pool_owner_.reset(new base::SequencedWorkerPoolOwner(3, "Background Pool"));
126 } 128 }
127 129
128 void CreateAndLoad(bool crypt_cookies, 130 void CreateAndLoad(bool crypt_cookies,
129 bool restore_old_session_cookies, 131 bool restore_old_session_cookies,
130 CanonicalCookieVector* cookies) { 132 CanonicalCookieVector* cookies) {
131 if (crypt_cookies) 133 if (crypt_cookies)
132 cookie_crypto_delegate_.reset(new CookieCryptor()); 134 cookie_crypto_delegate_.reset(new CookieCryptor());
133 135
134 store_ = new SQLitePersistentCookieStore( 136 store_ = new SQLitePersistentCookieStore(
135 temp_dir_.path().Append(kCookieFilename), 137 temp_dir_.path().Append(kCookieFilename), client_task_runner(),
136 client_task_runner(), 138 background_task_runner(), restore_old_session_cookies,
137 background_task_runner(),
138 restore_old_session_cookies,
139 NULL,
140 cookie_crypto_delegate_.get()); 139 cookie_crypto_delegate_.get());
141 Load(cookies); 140 Load(cookies);
142 } 141 }
143 142
144 void InitializeStore(bool crypt, bool restore_old_session_cookies) { 143 void InitializeStore(bool crypt, bool restore_old_session_cookies) {
145 CanonicalCookieVector cookies; 144 CanonicalCookieVector cookies;
146 CreateAndLoad(crypt, restore_old_session_cookies, &cookies); 145 CreateAndLoad(crypt, restore_old_session_cookies, &cookies);
147 EXPECT_EQ(0U, cookies.size()); 146 EXPECT_EQ(0U, cookies.size());
148 } 147 }
149 148
150 // We have to create this method to wrap WaitableEvent::Wait, since we cannot 149 // We have to create this method to wrap WaitableEvent::Wait, since we cannot
151 // bind a non-void returning method as a Closure. 150 // bind a non-void returning method as a Closure.
152 void WaitOnDBEvent() { 151 void WaitOnDBEvent() { db_thread_event_.Wait(); }
153 db_thread_event_.Wait();
154 }
155 152
156 // Adds a persistent cookie to store_. 153 // Adds a persistent cookie to store_.
157 void AddCookie(const std::string& name, 154 void AddCookie(const std::string& name,
158 const std::string& value, 155 const std::string& value,
159 const std::string& domain, 156 const std::string& domain,
160 const std::string& path, 157 const std::string& path,
161 const base::Time& creation) { 158 const base::Time& creation) {
162 store_->AddCookie(net::CanonicalCookie( 159 store_->AddCookie(CanonicalCookie(GURL(), name, value, domain, path,
163 GURL(), name, value, domain, path, creation, creation, creation, false, 160 creation, creation, creation, false,
164 false, false, net::COOKIE_PRIORITY_DEFAULT)); 161 false, false, COOKIE_PRIORITY_DEFAULT));
165 } 162 }
166 163
167 void AddCookieWithExpiration(const std::string& name, 164 void AddCookieWithExpiration(const std::string& name,
168 const std::string& value, 165 const std::string& value,
169 const std::string& domain, 166 const std::string& domain,
170 const std::string& path, 167 const std::string& path,
171 const base::Time& creation, 168 const base::Time& creation,
172 const base::Time& expiration) { 169 const base::Time& expiration) {
173 store_->AddCookie(net::CanonicalCookie( 170 store_->AddCookie(CanonicalCookie(GURL(), name, value, domain, path,
174 GURL(), name, value, domain, path, creation, expiration, creation, 171 creation, expiration, creation, false,
175 false, false, false, net::COOKIE_PRIORITY_DEFAULT)); 172 false, false, COOKIE_PRIORITY_DEFAULT));
176 } 173 }
177 174
178 std::string ReadRawDBContents() { 175 std::string ReadRawDBContents() {
179 std::string contents; 176 std::string contents;
180 if (!base::ReadFileToString(temp_dir_.path().Append(kCookieFilename), 177 if (!base::ReadFileToString(temp_dir_.path().Append(kCookieFilename),
181 &contents)) 178 &contents))
182 return std::string(); 179 return std::string();
183 return contents; 180 return contents;
184 } 181 }
185 182
186 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } 183 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); }
187 184
188 void TearDown() override { 185 void TearDown() override {
189 DestroyStore(); 186 DestroyStore();
190 pool_owner_->pool()->Shutdown(); 187 pool_owner_->pool()->Shutdown();
191 } 188 }
192 189
193 protected: 190 protected:
194 base::MessageLoop main_loop_;
195 scoped_ptr<base::SequencedWorkerPoolOwner> pool_owner_; 191 scoped_ptr<base::SequencedWorkerPoolOwner> pool_owner_;
196 base::WaitableEvent loaded_event_; 192 base::WaitableEvent loaded_event_;
197 base::WaitableEvent key_loaded_event_; 193 base::WaitableEvent key_loaded_event_;
198 base::WaitableEvent db_thread_event_; 194 base::WaitableEvent db_thread_event_;
199 CanonicalCookieVector cookies_; 195 CanonicalCookieVector cookies_;
200 base::ScopedTempDir temp_dir_; 196 base::ScopedTempDir temp_dir_;
201 scoped_refptr<SQLitePersistentCookieStore> store_; 197 scoped_refptr<SQLitePersistentCookieStore> store_;
202 scoped_ptr<net::CookieCryptoDelegate> cookie_crypto_delegate_; 198 scoped_ptr<CookieCryptoDelegate> cookie_crypto_delegate_;
203 }; 199 };
204 200
205 TEST_F(SQLitePersistentCookieStoreTest, TestInvalidMetaTableRecovery) { 201 TEST_F(SQLitePersistentCookieStoreTest, TestInvalidMetaTableRecovery) {
206 InitializeStore(false, false); 202 InitializeStore(false, false);
207 AddCookie("A", "B", "foo.bar", "/", base::Time::Now()); 203 AddCookie("A", "B", "foo.bar", "/", base::Time::Now());
208 DestroyStore(); 204 DestroyStore();
209 205
210 // Load up the store and verify that it has good data in it. 206 // Load up the store and verify that it has good data in it.
211 CanonicalCookieVector cookies; 207 CanonicalCookieVector cookies;
212 CreateAndLoad(false, false, &cookies); 208 CreateAndLoad(false, false, &cookies);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 AddCookieWithExpiration("A", "B", "b3.com", "/", t, base::Time()); 286 AddCookieWithExpiration("A", "B", "b3.com", "/", t, base::Time());
291 t += base::TimeDelta::FromInternalValue(10); 287 t += base::TimeDelta::FromInternalValue(10);
292 AddCookieWithExpiration("A", "B", "b4.com", "/", t, base::Time()); 288 AddCookieWithExpiration("A", "B", "b4.com", "/", t, base::Time());
293 t += base::TimeDelta::FromInternalValue(10); 289 t += base::TimeDelta::FromInternalValue(10);
294 AddCookieWithExpiration("A", "B", "b5.com", "/", t, base::Time()); 290 AddCookieWithExpiration("A", "B", "b5.com", "/", t, base::Time());
295 DestroyStore(); 291 DestroyStore();
296 292
297 // Load the store a second time. Before the store finishes loading, add a 293 // Load the store a second time. Before the store finishes loading, add a
298 // transient cookie and flush it to disk. 294 // transient cookie and flush it to disk.
299 store_ = new SQLitePersistentCookieStore( 295 store_ = new SQLitePersistentCookieStore(
300 temp_dir_.path().Append(kCookieFilename), 296 temp_dir_.path().Append(kCookieFilename), client_task_runner(),
301 client_task_runner(), 297 background_task_runner(), false, nullptr);
302 background_task_runner(),
303 false, NULL, NULL);
304 298
305 // Posting a blocking task to db_thread_ makes sure that the DB thread waits 299 // Posting a blocking task to db_thread_ makes sure that the DB thread waits
306 // until both Load and Flush have been posted to its task queue. 300 // until both Load and Flush have been posted to its task queue.
307 background_task_runner()->PostTask( 301 background_task_runner()->PostTask(
308 FROM_HERE, 302 FROM_HERE, base::Bind(&SQLitePersistentCookieStoreTest::WaitOnDBEvent,
309 base::Bind(&SQLitePersistentCookieStoreTest::WaitOnDBEvent, 303 base::Unretained(this)));
310 base::Unretained(this)));
311 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded, 304 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded,
312 base::Unretained(this))); 305 base::Unretained(this)));
313 t += base::TimeDelta::FromInternalValue(10); 306 t += base::TimeDelta::FromInternalValue(10);
314 AddCookieWithExpiration("A", "B", "c.com", "/", t, base::Time()); 307 AddCookieWithExpiration("A", "B", "c.com", "/", t, base::Time());
315 base::WaitableEvent event(false, false); 308 base::WaitableEvent event(false, false);
316 store_->Flush(base::Bind(&base::WaitableEvent::Signal, 309 store_->Flush(
317 base::Unretained(&event))); 310 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)));
318 311
319 // Now the DB-thread queue contains: 312 // Now the DB-thread queue contains:
320 // (active:) 313 // (active:)
321 // 1. Wait (on db_event) 314 // 1. Wait (on db_event)
322 // (pending:) 315 // (pending:)
323 // 2. "Init And Chain-Load First Domain" 316 // 2. "Init And Chain-Load First Domain"
324 // 3. Add Cookie (c.com) 317 // 3. Add Cookie (c.com)
325 // 4. Flush Cookie (c.com) 318 // 4. Flush Cookie (c.com)
326 db_thread_event_.Signal(); 319 db_thread_event_.Signal();
327 event.Wait(); 320 event.Wait();
328 loaded_event_.Wait(); 321 loaded_event_.Wait();
329 STLDeleteElements(&cookies_); 322 STLDeleteElements(&cookies_);
330 DestroyStore(); 323 DestroyStore();
331 324
332 // Load the store a third time, this time restoring session cookies. The 325 // Load the store a third time, this time restoring session cookies. The
333 // store should contain exactly 4 cookies: the 3 persistent, and "c.com", 326 // store should contain exactly 4 cookies: the 3 persistent, and "c.com",
334 // which was added during the second cookie store load. 327 // which was added during the second cookie store load.
335 store_ = new SQLitePersistentCookieStore( 328 store_ = new SQLitePersistentCookieStore(
336 temp_dir_.path().Append(kCookieFilename), 329 temp_dir_.path().Append(kCookieFilename), client_task_runner(),
337 client_task_runner(), 330 background_task_runner(), true, nullptr);
338 background_task_runner(),
339 true, NULL, NULL);
340 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded, 331 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded,
341 base::Unretained(this))); 332 base::Unretained(this)));
342 loaded_event_.Wait(); 333 loaded_event_.Wait();
343 ASSERT_EQ(4u, cookies_.size()); 334 ASSERT_EQ(4u, cookies_.size());
344 STLDeleteElements(&cookies_); 335 STLDeleteElements(&cookies_);
345 } 336 }
346 337
347 // Test that priority load of cookies for a specfic domain key could be 338 // Test that priority load of cookies for a specfic domain key could be
348 // completed before the entire store is loaded 339 // completed before the entire store is loaded
349 TEST_F(SQLitePersistentCookieStoreTest, TestLoadCookiesForKey) { 340 TEST_F(SQLitePersistentCookieStoreTest, TestLoadCookiesForKey) {
350 InitializeStore(false, false); 341 InitializeStore(false, false);
351 base::Time t = base::Time::Now(); 342 base::Time t = base::Time::Now();
352 AddCookie("A", "B", "foo.bar", "/", t); 343 AddCookie("A", "B", "foo.bar", "/", t);
353 t += base::TimeDelta::FromInternalValue(10); 344 t += base::TimeDelta::FromInternalValue(10);
354 AddCookie("A", "B", "www.aaa.com", "/", t); 345 AddCookie("A", "B", "www.aaa.com", "/", t);
355 t += base::TimeDelta::FromInternalValue(10); 346 t += base::TimeDelta::FromInternalValue(10);
356 AddCookie("A", "B", "travel.aaa.com", "/", t); 347 AddCookie("A", "B", "travel.aaa.com", "/", t);
357 t += base::TimeDelta::FromInternalValue(10); 348 t += base::TimeDelta::FromInternalValue(10);
358 AddCookie("A", "B", "www.bbb.com", "/", t); 349 AddCookie("A", "B", "www.bbb.com", "/", t);
359 DestroyStore(); 350 DestroyStore();
360 351
361 store_ = new SQLitePersistentCookieStore( 352 store_ = new SQLitePersistentCookieStore(
362 temp_dir_.path().Append(kCookieFilename), 353 temp_dir_.path().Append(kCookieFilename), client_task_runner(),
363 client_task_runner(), 354 background_task_runner(), false, nullptr);
364 background_task_runner(),
365 false, NULL, NULL);
366 355
367 // Posting a blocking task to db_thread_ makes sure that the DB thread waits 356 // Posting a blocking task to db_thread_ makes sure that the DB thread waits
368 // until both Load and LoadCookiesForKey have been posted to its task queue. 357 // until both Load and LoadCookiesForKey have been posted to its task queue.
369 background_task_runner()->PostTask( 358 background_task_runner()->PostTask(
370 FROM_HERE, 359 FROM_HERE, base::Bind(&SQLitePersistentCookieStoreTest::WaitOnDBEvent,
371 base::Bind(&SQLitePersistentCookieStoreTest::WaitOnDBEvent, 360 base::Unretained(this)));
372 base::Unretained(this)));
373 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded, 361 store_->Load(base::Bind(&SQLitePersistentCookieStoreTest::OnLoaded,
374 base::Unretained(this))); 362 base::Unretained(this)));
375 store_->LoadCookiesForKey("aaa.com", 363 store_->LoadCookiesForKey(
376 base::Bind(&SQLitePersistentCookieStoreTest::OnKeyLoaded, 364 "aaa.com", base::Bind(&SQLitePersistentCookieStoreTest::OnKeyLoaded,
377 base::Unretained(this))); 365 base::Unretained(this)));
378 background_task_runner()->PostTask( 366 background_task_runner()->PostTask(
379 FROM_HERE, 367 FROM_HERE, base::Bind(&SQLitePersistentCookieStoreTest::WaitOnDBEvent,
380 base::Bind(&SQLitePersistentCookieStoreTest::WaitOnDBEvent, 368 base::Unretained(this)));
381 base::Unretained(this)));
382 369
383 // Now the DB-thread queue contains: 370 // Now the DB-thread queue contains:
384 // (active:) 371 // (active:)
385 // 1. Wait (on db_event) 372 // 1. Wait (on db_event)
386 // (pending:) 373 // (pending:)
387 // 2. "Init And Chain-Load First Domain" 374 // 2. "Init And Chain-Load First Domain"
388 // 3. Priority Load (aaa.com) 375 // 3. Priority Load (aaa.com)
389 // 4. Wait (on db_event) 376 // 4. Wait (on db_event)
390 db_thread_event_.Signal(); 377 db_thread_event_.Signal();
391 key_loaded_event_.Wait(); 378 key_loaded_event_.Wait();
392 ASSERT_EQ(loaded_event_.IsSignaled(), false); 379 ASSERT_EQ(loaded_event_.IsSignaled(), false);
393 std::set<std::string> cookies_loaded; 380 std::set<std::string> cookies_loaded;
394 for (CanonicalCookieVector::const_iterator it = cookies_.begin(); 381 for (CanonicalCookieVector::const_iterator it = cookies_.begin();
395 it != cookies_.end(); 382 it != cookies_.end(); ++it) {
396 ++it) {
397 cookies_loaded.insert((*it)->Domain().c_str()); 383 cookies_loaded.insert((*it)->Domain().c_str());
398 } 384 }
399 STLDeleteElements(&cookies_); 385 STLDeleteElements(&cookies_);
400 ASSERT_GT(4U, cookies_loaded.size()); 386 ASSERT_GT(4U, cookies_loaded.size());
401 ASSERT_EQ(true, cookies_loaded.find("www.aaa.com") != cookies_loaded.end()); 387 ASSERT_EQ(true, cookies_loaded.find("www.aaa.com") != cookies_loaded.end());
402 ASSERT_EQ(true, 388 ASSERT_EQ(true,
403 cookies_loaded.find("travel.aaa.com") != cookies_loaded.end()); 389 cookies_loaded.find("travel.aaa.com") != cookies_loaded.end());
404 390
405 db_thread_event_.Signal(); 391 db_thread_event_.Signal();
406 loaded_event_.Wait(); 392 loaded_event_.Wait();
407 for (CanonicalCookieVector::const_iterator it = cookies_.begin(); 393 for (CanonicalCookieVector::const_iterator it = cookies_.begin();
408 it != cookies_.end(); 394 it != cookies_.end(); ++it) {
409 ++it) {
410 cookies_loaded.insert((*it)->Domain().c_str()); 395 cookies_loaded.insert((*it)->Domain().c_str());
411 } 396 }
412 ASSERT_EQ(4U, cookies_loaded.size()); 397 ASSERT_EQ(4U, cookies_loaded.size());
413 ASSERT_EQ(cookies_loaded.find("foo.bar") != cookies_loaded.end(), 398 ASSERT_EQ(cookies_loaded.find("foo.bar") != cookies_loaded.end(), true);
414 true);
415 ASSERT_EQ(cookies_loaded.find("www.bbb.com") != cookies_loaded.end(), true); 399 ASSERT_EQ(cookies_loaded.find("www.bbb.com") != cookies_loaded.end(), true);
416 STLDeleteElements(&cookies_); 400 STLDeleteElements(&cookies_);
417 } 401 }
418 402
419 // Test that we can force the database to be written by calling Flush(). 403 // Test that we can force the database to be written by calling Flush().
420 TEST_F(SQLitePersistentCookieStoreTest, TestFlush) { 404 TEST_F(SQLitePersistentCookieStoreTest, TestFlush) {
421 InitializeStore(false, false); 405 InitializeStore(false, false);
422 // File timestamps don't work well on all platforms, so we'll determine 406 // File timestamps don't work well on all platforms, so we'll determine
423 // whether the DB file has been modified by checking its size. 407 // whether the DB file has been modified by checking its size.
424 base::FilePath path = temp_dir_.path().Append(kCookieFilename); 408 base::FilePath path = temp_dir_.path().Append(kCookieFilename);
(...skipping 15 matching lines...) Expand all
440 // We forced a write, so now the file will be bigger. 424 // We forced a write, so now the file will be bigger.
441 ASSERT_TRUE(base::GetFileInfo(path, &info)); 425 ASSERT_TRUE(base::GetFileInfo(path, &info));
442 ASSERT_GT(info.size, base_size); 426 ASSERT_GT(info.size, base_size);
443 } 427 }
444 428
445 // Test loading old session cookies from the disk. 429 // Test loading old session cookies from the disk.
446 TEST_F(SQLitePersistentCookieStoreTest, TestLoadOldSessionCookies) { 430 TEST_F(SQLitePersistentCookieStoreTest, TestLoadOldSessionCookies) {
447 InitializeStore(false, true); 431 InitializeStore(false, true);
448 432
449 // Add a session cookie. 433 // Add a session cookie.
450 store_->AddCookie(net::CanonicalCookie(GURL(), "C", "D", "sessioncookie.com", 434 store_->AddCookie(CanonicalCookie(GURL(), "C", "D", "sessioncookie.com", "/",
451 "/", base::Time::Now(), base::Time(), 435 base::Time::Now(), base::Time(),
452 base::Time::Now(), false, false, false, 436 base::Time::Now(), false, false, false,
453 net::COOKIE_PRIORITY_DEFAULT)); 437 COOKIE_PRIORITY_DEFAULT));
454 438
455 // Force the store to write its data to the disk. 439 // Force the store to write its data to the disk.
456 DestroyStore(); 440 DestroyStore();
457 441
458 // Create a store that loads session cookies and test that the session cookie 442 // Create a store that loads session cookies and test that the session cookie
459 // was loaded. 443 // was loaded.
460 CanonicalCookieVector cookies; 444 CanonicalCookieVector cookies;
461 CreateAndLoad(false, true, &cookies); 445 CreateAndLoad(false, true, &cookies);
462 446
463 ASSERT_EQ(1U, cookies.size()); 447 ASSERT_EQ(1U, cookies.size());
464 ASSERT_STREQ("sessioncookie.com", cookies[0]->Domain().c_str()); 448 ASSERT_STREQ("sessioncookie.com", cookies[0]->Domain().c_str());
465 ASSERT_STREQ("C", cookies[0]->Name().c_str()); 449 ASSERT_STREQ("C", cookies[0]->Name().c_str());
466 ASSERT_STREQ("D", cookies[0]->Value().c_str()); 450 ASSERT_STREQ("D", cookies[0]->Value().c_str());
467 ASSERT_EQ(net::COOKIE_PRIORITY_DEFAULT, cookies[0]->Priority()); 451 ASSERT_EQ(COOKIE_PRIORITY_DEFAULT, cookies[0]->Priority());
468 452
469 STLDeleteElements(&cookies); 453 STLDeleteElements(&cookies);
470 } 454 }
471 455
472 // Test loading old session cookies from the disk. 456 // Test loading old session cookies from the disk.
473 TEST_F(SQLitePersistentCookieStoreTest, TestDontLoadOldSessionCookies) { 457 TEST_F(SQLitePersistentCookieStoreTest, TestDontLoadOldSessionCookies) {
474 InitializeStore(false, true); 458 InitializeStore(false, true);
475 459
476 // Add a session cookie. 460 // Add a session cookie.
477 store_->AddCookie(net::CanonicalCookie(GURL(), "C", "D", "sessioncookie.com", 461 store_->AddCookie(CanonicalCookie(GURL(), "C", "D", "sessioncookie.com", "/",
478 "/", base::Time::Now(), base::Time(), 462 base::Time::Now(), base::Time(),
479 base::Time::Now(), false, false, false, 463 base::Time::Now(), false, false, false,
480 net::COOKIE_PRIORITY_DEFAULT)); 464 COOKIE_PRIORITY_DEFAULT));
481 465
482 // Force the store to write its data to the disk. 466 // Force the store to write its data to the disk.
483 DestroyStore(); 467 DestroyStore();
484 468
485 // Create a store that doesn't load old session cookies and test that the 469 // Create a store that doesn't load old session cookies and test that the
486 // session cookie was not loaded. 470 // session cookie was not loaded.
487 CanonicalCookieVector cookies; 471 CanonicalCookieVector cookies;
488 CreateAndLoad(false, false, &cookies); 472 CreateAndLoad(false, false, &cookies);
489 ASSERT_EQ(0U, cookies.size()); 473 ASSERT_EQ(0U, cookies.size());
490 474
491 // The store should also delete the session cookie. Wait until that has been 475 // The store should also delete the session cookie. Wait until that has been
492 // done. 476 // done.
493 DestroyStore(); 477 DestroyStore();
494 478
495 // Create a store that loads old session cookies and test that the session 479 // Create a store that loads old session cookies and test that the session
496 // cookie is gone. 480 // cookie is gone.
497 CreateAndLoad(false, true, &cookies); 481 CreateAndLoad(false, true, &cookies);
498 ASSERT_EQ(0U, cookies.size()); 482 ASSERT_EQ(0U, cookies.size());
499 } 483 }
500 484
501 TEST_F(SQLitePersistentCookieStoreTest, PersistIsPersistent) { 485 TEST_F(SQLitePersistentCookieStoreTest, PersistIsPersistent) {
502 InitializeStore(false, true); 486 InitializeStore(false, true);
503 static const char kSessionName[] = "session"; 487 static const char kSessionName[] = "session";
504 static const char kPersistentName[] = "persistent"; 488 static const char kPersistentName[] = "persistent";
505 489
506 // Add a session cookie. 490 // Add a session cookie.
507 store_->AddCookie(net::CanonicalCookie( 491 store_->AddCookie(CanonicalCookie(GURL(), kSessionName, "val",
508 GURL(), kSessionName, "val", "sessioncookie.com", "/", base::Time::Now(), 492 "sessioncookie.com", "/", base::Time::Now(),
509 base::Time(), base::Time::Now(), false, false, false, 493 base::Time(), base::Time::Now(), false,
510 net::COOKIE_PRIORITY_DEFAULT)); 494 false, false, COOKIE_PRIORITY_DEFAULT));
511 // Add a persistent cookie. 495 // Add a persistent cookie.
512 store_->AddCookie(net::CanonicalCookie( 496 store_->AddCookie(CanonicalCookie(
513 GURL(), kPersistentName, "val", "sessioncookie.com", "/", 497 GURL(), kPersistentName, "val", "sessioncookie.com", "/",
514 base::Time::Now() - base::TimeDelta::FromDays(1), 498 base::Time::Now() - base::TimeDelta::FromDays(1),
515 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(), 499 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(),
516 false, false, false, net::COOKIE_PRIORITY_DEFAULT)); 500 false, false, false, COOKIE_PRIORITY_DEFAULT));
517 501
518 // Force the store to write its data to the disk. 502 // Force the store to write its data to the disk.
519 DestroyStore(); 503 DestroyStore();
520 504
521 // Create a store that loads session cookie and test that the IsPersistent 505 // Create a store that loads session cookie and test that the IsPersistent
522 // attribute is restored. 506 // attribute is restored.
523 CanonicalCookieVector cookies; 507 CanonicalCookieVector cookies;
524 CreateAndLoad(false, true, &cookies); 508 CreateAndLoad(false, true, &cookies);
525 ASSERT_EQ(2U, cookies.size()); 509 ASSERT_EQ(2U, cookies.size());
526 510
527 std::map<std::string, net::CanonicalCookie*> cookie_map; 511 std::map<std::string, CanonicalCookie*> cookie_map;
528 for (CanonicalCookieVector::const_iterator it = cookies.begin(); 512 for (CanonicalCookieVector::const_iterator it = cookies.begin();
529 it != cookies.end(); 513 it != cookies.end(); ++it) {
530 ++it) {
531 cookie_map[(*it)->Name()] = *it; 514 cookie_map[(*it)->Name()] = *it;
532 } 515 }
533 516
534 std::map<std::string, net::CanonicalCookie*>::const_iterator it = 517 std::map<std::string, CanonicalCookie*>::const_iterator it =
535 cookie_map.find(kSessionName); 518 cookie_map.find(kSessionName);
536 ASSERT_TRUE(it != cookie_map.end()); 519 ASSERT_TRUE(it != cookie_map.end());
537 EXPECT_FALSE(cookie_map[kSessionName]->IsPersistent()); 520 EXPECT_FALSE(cookie_map[kSessionName]->IsPersistent());
538 521
539 it = cookie_map.find(kPersistentName); 522 it = cookie_map.find(kPersistentName);
540 ASSERT_TRUE(it != cookie_map.end()); 523 ASSERT_TRUE(it != cookie_map.end());
541 EXPECT_TRUE(cookie_map[kPersistentName]->IsPersistent()); 524 EXPECT_TRUE(cookie_map[kPersistentName]->IsPersistent());
542 525
543 STLDeleteElements(&cookies); 526 STLDeleteElements(&cookies);
544 } 527 }
545 528
546 TEST_F(SQLitePersistentCookieStoreTest, PriorityIsPersistent) { 529 TEST_F(SQLitePersistentCookieStoreTest, PriorityIsPersistent) {
547 static const char kLowName[] = "low"; 530 static const char kLowName[] = "low";
548 static const char kMediumName[] = "medium"; 531 static const char kMediumName[] = "medium";
549 static const char kHighName[] = "high"; 532 static const char kHighName[] = "high";
550 static const char kCookieDomain[] = "sessioncookie.com"; 533 static const char kCookieDomain[] = "sessioncookie.com";
551 static const char kCookieValue[] = "value"; 534 static const char kCookieValue[] = "value";
552 static const char kCookiePath[] = "/"; 535 static const char kCookiePath[] = "/";
553 536
554 InitializeStore(false, true); 537 InitializeStore(false, true);
555 538
556 // Add a low-priority persistent cookie. 539 // Add a low-priority persistent cookie.
557 store_->AddCookie(net::CanonicalCookie( 540 store_->AddCookie(CanonicalCookie(
558 GURL(), kLowName, kCookieValue, kCookieDomain, kCookiePath, 541 GURL(), kLowName, kCookieValue, kCookieDomain, kCookiePath,
559 base::Time::Now() - base::TimeDelta::FromMinutes(1), 542 base::Time::Now() - base::TimeDelta::FromMinutes(1),
560 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(), 543 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(),
561 false, false, false, net::COOKIE_PRIORITY_LOW)); 544 false, false, false, COOKIE_PRIORITY_LOW));
562 545
563 // Add a medium-priority persistent cookie. 546 // Add a medium-priority persistent cookie.
564 store_->AddCookie(net::CanonicalCookie( 547 store_->AddCookie(CanonicalCookie(
565 GURL(), kMediumName, kCookieValue, kCookieDomain, kCookiePath, 548 GURL(), kMediumName, kCookieValue, kCookieDomain, kCookiePath,
566 base::Time::Now() - base::TimeDelta::FromMinutes(2), 549 base::Time::Now() - base::TimeDelta::FromMinutes(2),
567 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(), 550 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(),
568 false, false, false, net::COOKIE_PRIORITY_MEDIUM)); 551 false, false, false, COOKIE_PRIORITY_MEDIUM));
569 552
570 // Add a high-priority peristent cookie. 553 // Add a high-priority peristent cookie.
571 store_->AddCookie(net::CanonicalCookie( 554 store_->AddCookie(CanonicalCookie(
572 GURL(), kHighName, kCookieValue, kCookieDomain, kCookiePath, 555 GURL(), kHighName, kCookieValue, kCookieDomain, kCookiePath,
573 base::Time::Now() - base::TimeDelta::FromMinutes(3), 556 base::Time::Now() - base::TimeDelta::FromMinutes(3),
574 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(), 557 base::Time::Now() + base::TimeDelta::FromDays(1), base::Time::Now(),
575 false, false, false, net::COOKIE_PRIORITY_HIGH)); 558 false, false, false, COOKIE_PRIORITY_HIGH));
576 559
577 // Force the store to write its data to the disk. 560 // Force the store to write its data to the disk.
578 DestroyStore(); 561 DestroyStore();
579 562
580 // Create a store that loads session cookie and test that the priority 563 // Create a store that loads session cookie and test that the priority
581 // attribute values are restored. 564 // attribute values are restored.
582 CanonicalCookieVector cookies; 565 CanonicalCookieVector cookies;
583 CreateAndLoad(false, true, &cookies); 566 CreateAndLoad(false, true, &cookies);
584 ASSERT_EQ(3U, cookies.size()); 567 ASSERT_EQ(3U, cookies.size());
585 568
586 // Put the cookies into a map, by name, so we can easily find them. 569 // Put the cookies into a map, by name, so we can easily find them.
587 std::map<std::string, net::CanonicalCookie*> cookie_map; 570 std::map<std::string, CanonicalCookie*> cookie_map;
588 for (CanonicalCookieVector::const_iterator it = cookies.begin(); 571 for (CanonicalCookieVector::const_iterator it = cookies.begin();
589 it != cookies.end(); 572 it != cookies.end(); ++it) {
590 ++it) {
591 cookie_map[(*it)->Name()] = *it; 573 cookie_map[(*it)->Name()] = *it;
592 } 574 }
593 575
594 // Validate that each cookie has the correct priority. 576 // Validate that each cookie has the correct priority.
595 std::map<std::string, net::CanonicalCookie*>::const_iterator it = 577 std::map<std::string, CanonicalCookie*>::const_iterator it =
596 cookie_map.find(kLowName); 578 cookie_map.find(kLowName);
597 ASSERT_TRUE(it != cookie_map.end()); 579 ASSERT_TRUE(it != cookie_map.end());
598 EXPECT_EQ(net::COOKIE_PRIORITY_LOW, cookie_map[kLowName]->Priority()); 580 EXPECT_EQ(COOKIE_PRIORITY_LOW, cookie_map[kLowName]->Priority());
599 581
600 it = cookie_map.find(kMediumName); 582 it = cookie_map.find(kMediumName);
601 ASSERT_TRUE(it != cookie_map.end()); 583 ASSERT_TRUE(it != cookie_map.end());
602 EXPECT_EQ(net::COOKIE_PRIORITY_MEDIUM, cookie_map[kMediumName]->Priority()); 584 EXPECT_EQ(COOKIE_PRIORITY_MEDIUM, cookie_map[kMediumName]->Priority());
603 585
604 it = cookie_map.find(kHighName); 586 it = cookie_map.find(kHighName);
605 ASSERT_TRUE(it != cookie_map.end()); 587 ASSERT_TRUE(it != cookie_map.end());
606 EXPECT_EQ(net::COOKIE_PRIORITY_HIGH, cookie_map[kHighName]->Priority()); 588 EXPECT_EQ(COOKIE_PRIORITY_HIGH, cookie_map[kHighName]->Priority());
607 589
608 STLDeleteElements(&cookies); 590 STLDeleteElements(&cookies);
609 } 591 }
610 592
611 TEST_F(SQLitePersistentCookieStoreTest, UpdateToEncryption) { 593 TEST_F(SQLitePersistentCookieStoreTest, UpdateToEncryption) {
612 CanonicalCookieVector cookies; 594 CanonicalCookieVector cookies;
613 595
614 // Create unencrypted cookie store and write something to it. 596 // Create unencrypted cookie store and write something to it.
615 InitializeStore(false, false); 597 InitializeStore(false, false);
616 AddCookie("name", "value123XYZ", "foo.bar", "/", base::Time::Now()); 598 AddCookie("name", "value123XYZ", "foo.bar", "/", base::Time::Now());
(...skipping 15 matching lines...) Expand all
632 614
633 // Make sure we can update existing cookie and add new cookie as encrypted. 615 // Make sure we can update existing cookie and add new cookie as encrypted.
634 store_->DeleteCookie(*(cookies_[0])); 616 store_->DeleteCookie(*(cookies_[0]));
635 AddCookie("name", "encrypted_value123XYZ", "foo.bar", "/", base::Time::Now()); 617 AddCookie("name", "encrypted_value123XYZ", "foo.bar", "/", base::Time::Now());
636 AddCookie("other", "something456ABC", "foo.bar", "/", 618 AddCookie("other", "something456ABC", "foo.bar", "/",
637 base::Time::Now() + base::TimeDelta::FromInternalValue(10)); 619 base::Time::Now() + base::TimeDelta::FromInternalValue(10));
638 DestroyStore(); 620 DestroyStore();
639 STLDeleteElements(&cookies_); 621 STLDeleteElements(&cookies_);
640 CreateAndLoad(true, false, &cookies); 622 CreateAndLoad(true, false, &cookies);
641 EXPECT_EQ(2U, cookies_.size()); 623 EXPECT_EQ(2U, cookies_.size());
642 net::CanonicalCookie* cookie_name = NULL; 624 CanonicalCookie* cookie_name = nullptr;
643 net::CanonicalCookie* cookie_other = NULL; 625 CanonicalCookie* cookie_other = nullptr;
644 if (cookies_[0]->Name() == "name") { 626 if (cookies_[0]->Name() == "name") {
645 cookie_name = cookies_[0]; 627 cookie_name = cookies_[0];
646 cookie_other = cookies_[1]; 628 cookie_other = cookies_[1];
647 } else { 629 } else {
648 cookie_name = cookies_[1]; 630 cookie_name = cookies_[1];
649 cookie_other = cookies_[0]; 631 cookie_other = cookies_[0];
650 } 632 }
651 EXPECT_EQ("encrypted_value123XYZ", cookie_name->Value()); 633 EXPECT_EQ("encrypted_value123XYZ", cookie_name->Value());
652 EXPECT_EQ("something456ABC", cookie_other->Value()); 634 EXPECT_EQ("something456ABC", cookie_other->Value());
653 DestroyStore(); 635 DestroyStore();
654 STLDeleteElements(&cookies_); 636 STLDeleteElements(&cookies_);
655 637
656 // Examine the real record to make sure plaintext version doesn't exist. 638 // Examine the real record to make sure plaintext version doesn't exist.
657 sql::Connection db; 639 sql::Connection db;
658 sql::Statement smt; 640 sql::Statement smt;
659 int resultcount = 0; 641 int resultcount = 0;
660 ASSERT_TRUE(db.Open(temp_dir_.path().Append(kCookieFilename))); 642 ASSERT_TRUE(db.Open(temp_dir_.path().Append(kCookieFilename)));
661 smt.Assign(db.GetCachedStatement(SQL_FROM_HERE, 643 smt.Assign(db.GetCachedStatement(SQL_FROM_HERE,
662 "SELECT * " 644 "SELECT * "
663 "FROM cookies " 645 "FROM cookies "
664 "WHERE host_key = 'foo.bar'")); 646 "WHERE host_key = 'foo.bar'"));
665 while (smt.Step()) { 647 while (smt.Step()) {
666 resultcount++; 648 resultcount++;
667 for (int i=0; i < smt.ColumnCount(); i++) { 649 for (int i = 0; i < smt.ColumnCount(); i++) {
668 EXPECT_EQ(smt.ColumnString(i).find("value"), std::string::npos); 650 EXPECT_EQ(smt.ColumnString(i).find("value"), std::string::npos);
669 EXPECT_EQ(smt.ColumnString(i).find("something"), std::string::npos); 651 EXPECT_EQ(smt.ColumnString(i).find("something"), std::string::npos);
670 } 652 }
671 } 653 }
672 EXPECT_EQ(2, resultcount); 654 EXPECT_EQ(2, resultcount);
673 655
674 // Verify that "encrypted_value" is NOT visible in the file. 656 // Verify that "encrypted_value" is NOT visible in the file.
675 contents = ReadRawDBContents(); 657 contents = ReadRawDBContents();
676 EXPECT_NE(0U, contents.length()); 658 EXPECT_NE(0U, contents.length());
677 EXPECT_EQ(contents.find("encrypted_value123XYZ"), std::string::npos); 659 EXPECT_EQ(contents.find("encrypted_value123XYZ"), std::string::npos);
678 EXPECT_EQ(contents.find("something456ABC"), std::string::npos); 660 EXPECT_EQ(contents.find("something456ABC"), std::string::npos);
679 } 661 }
680 662
681 } // namespace content 663 } // namespace net
OLDNEW
« no previous file with comments | « net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698