| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" | 5 #include "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 namespace component_updater { | 38 namespace component_updater { |
| 39 | 39 |
| 40 MockServiceObserver::MockServiceObserver() { | 40 MockServiceObserver::MockServiceObserver() { |
| 41 } | 41 } |
| 42 | 42 |
| 43 MockServiceObserver::~MockServiceObserver() { | 43 MockServiceObserver::~MockServiceObserver() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 ComponentUpdaterTest::ComponentUpdaterTest() | 46 ComponentUpdaterTest::ComponentUpdaterTest() |
| 47 : test_config_(NULL), | 47 : post_interceptor_(NULL), |
| 48 test_config_(NULL), |
| 48 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 49 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
| 49 // The component updater instance under test. | 50 // The component updater instance under test. |
| 50 test_config_ = new TestConfigurator; | 51 test_config_ = new TestConfigurator( |
| 52 BrowserThread::GetBlockingPool() |
| 53 ->GetSequencedTaskRunnerWithShutdownBehavior( |
| 54 BrowserThread::GetBlockingPool()->GetSequenceToken(), |
| 55 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN), |
| 56 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 51 component_updater_.reset(ComponentUpdateServiceFactory(test_config_)); | 57 component_updater_.reset(ComponentUpdateServiceFactory(test_config_)); |
| 52 | 58 |
| 53 net::URLFetcher::SetEnableInterceptionForTests(true); | 59 net::URLFetcher::SetEnableInterceptionForTests(true); |
| 54 } | 60 } |
| 55 | 61 |
| 56 ComponentUpdaterTest::~ComponentUpdaterTest() { | 62 ComponentUpdaterTest::~ComponentUpdaterTest() { |
| 57 net::URLFetcher::SetEnableInterceptionForTests(false); | 63 net::URLFetcher::SetEnableInterceptionForTests(false); |
| 58 } | 64 } |
| 59 | 65 |
| 60 void ComponentUpdaterTest::SetUp() { | 66 void ComponentUpdaterTest::SetUp() { |
| 61 get_interceptor_.reset(new GetInterceptor); | 67 get_interceptor_.reset(new GetInterceptor); |
| 62 interceptor_factory_.reset(new InterceptorFactory); | 68 interceptor_factory_.reset(new InterceptorFactory( |
| 69 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| 63 post_interceptor_ = interceptor_factory_->CreateInterceptor(); | 70 post_interceptor_ = interceptor_factory_->CreateInterceptor(); |
| 64 EXPECT_TRUE(post_interceptor_); | 71 EXPECT_TRUE(post_interceptor_); |
| 65 } | 72 } |
| 66 | 73 |
| 67 void ComponentUpdaterTest::TearDown() { | 74 void ComponentUpdaterTest::TearDown() { |
| 68 interceptor_factory_.reset(); | 75 interceptor_factory_.reset(); |
| 69 get_interceptor_.reset(); | 76 get_interceptor_.reset(); |
| 70 xmlCleanupGlobals(); | 77 xmlCleanupGlobals(); |
| 71 } | 78 } |
| 72 | 79 |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 component_updater()->RemoveObserver(&observer2); | 1485 component_updater()->RemoveObserver(&observer2); |
| 1479 | 1486 |
| 1480 test_configurator()->SetLoopCount(1); | 1487 test_configurator()->SetLoopCount(1); |
| 1481 component_updater()->Start(); | 1488 component_updater()->Start(); |
| 1482 RunThreads(); | 1489 RunThreads(); |
| 1483 | 1490 |
| 1484 component_updater()->Stop(); | 1491 component_updater()->Stop(); |
| 1485 } | 1492 } |
| 1486 | 1493 |
| 1487 } // namespace component_updater | 1494 } // namespace component_updater |
| OLD | NEW |