| Index: chrome/browser/net/http_server_properties_manager_unittest.cc
|
| diff --git a/chrome/browser/net/http_server_properties_manager_unittest.cc b/chrome/browser/net/http_server_properties_manager_unittest.cc
|
| index b60b59ca9c9b5ff96b5c31425a01cd20184f3694..efc37841264ef82ecdd3af0297c090948ba41fdb 100644
|
| --- a/chrome/browser/net/http_server_properties_manager_unittest.cc
|
| +++ b/chrome/browser/net/http_server_properties_manager_unittest.cc
|
| @@ -54,12 +54,12 @@ class TestingHttpServerPropertiesManager : public HttpServerPropertiesManager {
|
| base::TimeDelta());
|
| }
|
|
|
| - void UpdatePrefsFromCacheOnIOConcrete() {
|
| - HttpServerPropertiesManager::UpdatePrefsFromCacheOnIO();
|
| + void UpdatePrefsFromCacheOnIOConcrete(const base::Closure& callback) {
|
| + HttpServerPropertiesManager::UpdatePrefsFromCacheOnIO(callback);
|
| }
|
|
|
| MOCK_METHOD0(UpdateCacheFromPrefsOnUI, void());
|
| - MOCK_METHOD0(UpdatePrefsFromCacheOnIO, void());
|
| + MOCK_METHOD1(UpdatePrefsFromCacheOnIO, void(const base::Closure&));
|
| MOCK_METHOD5(UpdateCacheFromPrefsOnIO,
|
| void(std::vector<std::string>* spdy_servers,
|
| net::SpdySettingsMap* spdy_settings_map,
|
| @@ -76,6 +76,25 @@ class TestingHttpServerPropertiesManager : public HttpServerPropertiesManager {
|
| DISALLOW_COPY_AND_ASSIGN(TestingHttpServerPropertiesManager);
|
| };
|
|
|
| +class MockClosure : public base::RefCountedThreadSafe<MockClosure> {
|
| + public:
|
| + MOCK_METHOD0(MockMethod, void());
|
| +
|
| + static base::Closure NewExpectedClosure() {
|
| + scoped_refptr<MockClosure> mock_closure(new MockClosure);
|
| + EXPECT_CALL(*mock_closure, MockMethod());
|
| + return base::Bind(&MockClosure::MockMethod, mock_closure);
|
| + }
|
| +
|
| + protected:
|
| + friend class base::RefCountedThreadSafe<MockClosure>;
|
| + virtual ~MockClosure() {}
|
| +
|
| + private:
|
| + MockClosure() {}
|
| + DISALLOW_COPY_AND_ASSIGN(MockClosure);
|
| +};
|
| +
|
| class HttpServerPropertiesManagerTest : public testing::Test {
|
| protected:
|
| HttpServerPropertiesManagerTest()
|
| @@ -109,7 +128,7 @@ class HttpServerPropertiesManagerTest : public testing::Test {
|
| }
|
|
|
| void ExpectPrefsUpdate() {
|
| - EXPECT_CALL(*http_server_props_manager_, UpdatePrefsFromCacheOnIO())
|
| + EXPECT_CALL(*http_server_props_manager_, UpdatePrefsFromCacheOnIO(_))
|
| .WillOnce(
|
| Invoke(http_server_props_manager_.get(),
|
| &TestingHttpServerPropertiesManager::
|
| @@ -353,8 +372,9 @@ TEST_F(HttpServerPropertiesManagerTest, Clear) {
|
| Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
|
|
|
| ExpectPrefsUpdate();
|
| +
|
| // Clear http server data.
|
| - http_server_props_manager_->Clear();
|
| + http_server_props_manager_->Clear(MockClosure::NewExpectedClosure());
|
|
|
| // Run the task.
|
| loop_.RunAllPending();
|
| @@ -434,7 +454,7 @@ TEST_F(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdatePrefs1) {
|
|
|
| TEST_F(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdatePrefs2) {
|
| // This posts a task to the UI thread.
|
| - http_server_props_manager_->UpdatePrefsFromCacheOnIOConcrete();
|
| + http_server_props_manager_->UpdatePrefsFromCacheOnIOConcrete(base::Closure());
|
| // Shutdown comes before the task is executed.
|
| http_server_props_manager_->ShutdownOnUIThread();
|
| // Run the task after shutdown, but before deletion.
|
|
|