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

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

Issue 10797017: base: Make ScopedVector::clear() destroy elements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update location_bar_view_mac.mm Created 8 years, 5 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 (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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ASSERT_STREQ("d", ec_cert->cert().c_str()); 129 ASSERT_STREQ("d", ec_cert->cert().c_str());
130 ASSERT_EQ(3, ec_cert->creation_time().ToInternalValue()); 130 ASSERT_EQ(3, ec_cert->creation_time().ToInternalValue());
131 ASSERT_EQ(4, ec_cert->expiration_time().ToInternalValue()); 131 ASSERT_EQ(4, ec_cert->expiration_time().ToInternalValue());
132 132
133 // Now delete the cert and check persistence again. 133 // Now delete the cert and check persistence again.
134 store_->DeleteServerBoundCert(*certs[0]); 134 store_->DeleteServerBoundCert(*certs[0]);
135 store_->DeleteServerBoundCert(*certs[1]); 135 store_->DeleteServerBoundCert(*certs[1]);
136 store_ = NULL; 136 store_ = NULL;
137 // Make sure we wait until the destructor has run. 137 // Make sure we wait until the destructor has run.
138 ASSERT_TRUE(helper->Run()); 138 ASSERT_TRUE(helper->Run());
139 certs.reset(); 139 certs.clear();
140 store_ = new SQLiteServerBoundCertStore( 140 store_ = new SQLiteServerBoundCertStore(
141 temp_dir_.path().Append(chrome::kOBCertFilename), NULL); 141 temp_dir_.path().Append(chrome::kOBCertFilename), NULL);
142 142
143 // Reload and check if the cert has been removed. 143 // Reload and check if the cert has been removed.
144 ASSERT_TRUE(store_->Load(&certs.get())); 144 ASSERT_TRUE(store_->Load(&certs.get()));
145 ASSERT_EQ(0U, certs.size()); 145 ASSERT_EQ(0U, certs.size());
146 } 146 }
147 147
148 TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV1) { 148 TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV1) {
149 // Reset the store. We'll be using a different database for this test. 149 // Reset the store. We'll be using a different database for this test.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // We've put a exit policy in place, but force the state to be saved. 562 // We've put a exit policy in place, but force the state to be saved.
563 store_->SetForceKeepSessionState(); 563 store_->SetForceKeepSessionState();
564 store_ = NULL; 564 store_ = NULL;
565 ASSERT_TRUE(helper->Run()); 565 ASSERT_TRUE(helper->Run());
566 566
567 // Reload the store and check that the certs are still there. 567 // Reload the store and check that the certs are still there.
568 store_ = new SQLiteServerBoundCertStore( 568 store_ = new SQLiteServerBoundCertStore(
569 temp_dir_.path().AppendASCII("ClearOnExitDB"), clear_policy.get()); 569 temp_dir_.path().AppendASCII("ClearOnExitDB"), clear_policy.get());
570 570
571 // Reload and test for persistence 571 // Reload and test for persistence
572 certs.reset(); 572 certs.clear();
573 ASSERT_TRUE(store_->Load(&certs.get())); 573 ASSERT_TRUE(store_->Load(&certs.get()));
574 ASSERT_EQ(3U, certs.size()); 574 ASSERT_EQ(3U, certs.size());
575 575
576 // Delete the store. This time, the exit policy should be in place. 576 // Delete the store. This time, the exit policy should be in place.
577 store_ = NULL; 577 store_ = NULL;
578 // Make sure we wait until the destructor has run. 578 // Make sure we wait until the destructor has run.
579 ASSERT_TRUE(helper->Run()); 579 ASSERT_TRUE(helper->Run());
580 580
581 store_ = new SQLiteServerBoundCertStore( 581 store_ = new SQLiteServerBoundCertStore(
582 temp_dir_.path().AppendASCII("ClearOnExitDB"), clear_policy.get()); 582 temp_dir_.path().AppendASCII("ClearOnExitDB"), clear_policy.get());
583 583
584 // Reload and test for persistence 584 // Reload and test for persistence
585 certs.reset(); 585 certs.clear();
586 ASSERT_TRUE(store_->Load(&certs.get())); 586 ASSERT_TRUE(store_->Load(&certs.get()));
587 ASSERT_EQ(2U, certs.size()); 587 ASSERT_EQ(2U, certs.size());
588 588
589 ASSERT_TRUE(CertificateExistsInList(&certs.get(), 589 ASSERT_TRUE(CertificateExistsInList(&certs.get(),
590 "other.com", 590 "other.com",
591 net::CLIENT_CERT_RSA_SIGN, 591 net::CLIENT_CERT_RSA_SIGN,
592 "a", "b", 1, 2)); 592 "a", "b", 1, 2));
593 ASSERT_TRUE(CertificateExistsInList(&certs.get(), 593 ASSERT_TRUE(CertificateExistsInList(&certs.get(),
594 "protected.com", 594 "protected.com",
595 net::CLIENT_CERT_RSA_SIGN, 595 net::CLIENT_CERT_RSA_SIGN,
596 "n", "m", 5, 6)); 596 "n", "m", 5, 6));
597 } 597 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/password_manager/password_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698