OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/test/sequenced_worker_pool_owner.h" | 8 #include "base/test/sequenced_worker_pool_owner.h" |
9 #include "content/browser/media/webrtc_identity_store.h" | 9 #include "content/browser/media/webrtc_identity_store.h" |
10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 WebRTCIdentityStoreTest() | 42 WebRTCIdentityStoreTest() |
43 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP | | 43 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP | |
44 TestBrowserThreadBundle::REAL_DB_THREAD), | 44 TestBrowserThreadBundle::REAL_DB_THREAD), |
45 pool_owner_( | 45 pool_owner_( |
46 new base::SequencedWorkerPoolOwner(3, "WebRTCIdentityStoreTest")), | 46 new base::SequencedWorkerPoolOwner(3, "WebRTCIdentityStoreTest")), |
47 webrtc_identity_store_( | 47 webrtc_identity_store_( |
48 new WebRTCIdentityStore(base::FilePath(), NULL)) { | 48 new WebRTCIdentityStore(base::FilePath(), NULL)) { |
49 webrtc_identity_store_->SetTaskRunnerForTesting(pool_owner_->pool()); | 49 webrtc_identity_store_->SetTaskRunnerForTesting(pool_owner_->pool()); |
50 } | 50 } |
51 | 51 |
52 virtual ~WebRTCIdentityStoreTest() { | 52 ~WebRTCIdentityStoreTest() override { pool_owner_->pool()->Shutdown(); } |
53 pool_owner_->pool()->Shutdown(); | |
54 } | |
55 | 53 |
56 void SetValidityPeriod(base::TimeDelta validity_period) { | 54 void SetValidityPeriod(base::TimeDelta validity_period) { |
57 webrtc_identity_store_->SetValidityPeriodForTesting(validity_period); | 55 webrtc_identity_store_->SetValidityPeriodForTesting(validity_period); |
58 } | 56 } |
59 | 57 |
60 void RunUntilIdle() { | 58 void RunUntilIdle() { |
61 RunAllPendingInMessageLoop(BrowserThread::DB); | 59 RunAllPendingInMessageLoop(BrowserThread::DB); |
62 RunAllPendingInMessageLoop(BrowserThread::IO); | 60 RunAllPendingInMessageLoop(BrowserThread::IO); |
63 pool_owner_->pool()->FlushForTesting(); | 61 pool_owner_->pool()->FlushForTesting(); |
64 base::RunLoop().RunUntilIdle(); | 62 base::RunLoop().RunUntilIdle(); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 webrtc_identity_store_ = NULL; | 368 webrtc_identity_store_ = NULL; |
371 RunUntilIdle(); | 369 RunUntilIdle(); |
372 | 370 |
373 // Verifies the corrupted table was razed. | 371 // Verifies the corrupted table was razed. |
374 scoped_ptr<sql::Connection> db(new sql::Connection()); | 372 scoped_ptr<sql::Connection> db(new sql::Connection()); |
375 EXPECT_TRUE(db->Open(db_path)); | 373 EXPECT_TRUE(db->Open(db_path)); |
376 EXPECT_EQ(0U, sql::test::CountSQLTables(db.get())); | 374 EXPECT_EQ(0U, sql::test::CountSQLTables(db.get())); |
377 } | 375 } |
378 | 376 |
379 } // namespace content | 377 } // namespace content |
OLD | NEW |