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