| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/http/http_server_properties_manager.h" | 5 #include "net/http/http_server_properties_manager.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
| 10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 net::SupportsQuicMap* supports_quic_map)); | 80 net::SupportsQuicMap* supports_quic_map)); |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 DISALLOW_COPY_AND_ASSIGN(TestingHttpServerPropertiesManager); | 83 DISALLOW_COPY_AND_ASSIGN(TestingHttpServerPropertiesManager); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 class HttpServerPropertiesManagerTest : public testing::Test { | 86 class HttpServerPropertiesManagerTest : public testing::Test { |
| 87 protected: | 87 protected: |
| 88 HttpServerPropertiesManagerTest() {} | 88 HttpServerPropertiesManagerTest() {} |
| 89 | 89 |
| 90 virtual void SetUp() override { | 90 void SetUp() override { |
| 91 pref_service_.registry()->RegisterDictionaryPref(kTestHttpServerProperties); | 91 pref_service_.registry()->RegisterDictionaryPref(kTestHttpServerProperties); |
| 92 http_server_props_manager_.reset( | 92 http_server_props_manager_.reset( |
| 93 new StrictMock<TestingHttpServerPropertiesManager>( | 93 new StrictMock<TestingHttpServerPropertiesManager>( |
| 94 &pref_service_, | 94 &pref_service_, |
| 95 kTestHttpServerProperties, | 95 kTestHttpServerProperties, |
| 96 base::MessageLoop::current()->message_loop_proxy())); | 96 base::MessageLoop::current()->message_loop_proxy())); |
| 97 ExpectCacheUpdate(); | 97 ExpectCacheUpdate(); |
| 98 base::RunLoop().RunUntilIdle(); | 98 base::RunLoop().RunUntilIdle(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 virtual void TearDown() override { | 101 void TearDown() override { |
| 102 if (http_server_props_manager_.get()) | 102 if (http_server_props_manager_.get()) |
| 103 http_server_props_manager_->ShutdownOnPrefThread(); | 103 http_server_props_manager_->ShutdownOnPrefThread(); |
| 104 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
| 105 http_server_props_manager_.reset(); | 105 http_server_props_manager_.reset(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ExpectCacheUpdate() { | 108 void ExpectCacheUpdate() { |
| 109 EXPECT_CALL(*http_server_props_manager_, UpdateCacheFromPrefsOnPrefThread()) | 109 EXPECT_CALL(*http_server_props_manager_, UpdateCacheFromPrefsOnPrefThread()) |
| 110 .WillOnce(Invoke(http_server_props_manager_.get(), | 110 .WillOnce(Invoke(http_server_props_manager_.get(), |
| 111 &TestingHttpServerPropertiesManager:: | 111 &TestingHttpServerPropertiesManager:: |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // Run the task after shutdown, but before deletion. | 528 // Run the task after shutdown, but before deletion. |
| 529 base::RunLoop().RunUntilIdle(); | 529 base::RunLoop().RunUntilIdle(); |
| 530 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 530 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
| 531 http_server_props_manager_.reset(); | 531 http_server_props_manager_.reset(); |
| 532 base::RunLoop().RunUntilIdle(); | 532 base::RunLoop().RunUntilIdle(); |
| 533 } | 533 } |
| 534 | 534 |
| 535 } // namespace | 535 } // namespace |
| 536 | 536 |
| 537 } // namespace net | 537 } // namespace net |
| OLD | NEW |