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 ~WebRtcIdentityStoreTest() override { pool_owner_->pool()->Shutdown(); } |
| 53 |
52 void SetValidityPeriod(base::TimeDelta validity_period) { | 54 void SetValidityPeriod(base::TimeDelta validity_period) { |
53 webrtc_identity_store_->SetValidityPeriodForTesting(validity_period); | 55 webrtc_identity_store_->SetValidityPeriodForTesting(validity_period); |
54 } | 56 } |
55 | 57 |
56 void RunUntilIdle() { | 58 void RunUntilIdle() { |
57 RunAllPendingInMessageLoop(BrowserThread::DB); | 59 RunAllPendingInMessageLoop(BrowserThread::DB); |
58 RunAllPendingInMessageLoop(BrowserThread::IO); | 60 RunAllPendingInMessageLoop(BrowserThread::IO); |
59 pool_owner_->pool()->FlushForTesting(); | 61 pool_owner_->pool()->FlushForTesting(); |
60 base::RunLoop().RunUntilIdle(); | 62 base::RunLoop().RunUntilIdle(); |
61 } | 63 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 387 |
386 // Verifies the corrupted table was razed. | 388 // Verifies the corrupted table was razed. |
387 scoped_ptr<sql::Connection> db(new sql::Connection()); | 389 scoped_ptr<sql::Connection> db(new sql::Connection()); |
388 EXPECT_TRUE(db->Open(db_path)); | 390 EXPECT_TRUE(db->Open(db_path)); |
389 EXPECT_EQ(0U, sql::test::CountSQLTables(db.get())); | 391 EXPECT_EQ(0U, sql::test::CountSQLTables(db.get())); |
390 | 392 |
391 Stop(); | 393 Stop(); |
392 } | 394 } |
393 | 395 |
394 } // namespace content | 396 } // namespace content |
OLD | NEW |