| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/net/http_server_properties_manager.h" | 5 #include "chrome/browser/net/http_server_properties_manager.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 void ExpectPrefsUpdate() { | 113 void ExpectPrefsUpdate() { |
| 114 EXPECT_CALL(*http_server_props_manager_, UpdatePrefsFromCacheOnIO(_)) | 114 EXPECT_CALL(*http_server_props_manager_, UpdatePrefsFromCacheOnIO(_)) |
| 115 .WillOnce( | 115 .WillOnce( |
| 116 Invoke(http_server_props_manager_.get(), | 116 Invoke(http_server_props_manager_.get(), |
| 117 &TestingHttpServerPropertiesManager:: | 117 &TestingHttpServerPropertiesManager:: |
| 118 UpdatePrefsFromCacheOnIOConcrete)); | 118 UpdatePrefsFromCacheOnIOConcrete)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 MessageLoop loop_; | 121 base::MessageLoop loop_; |
| 122 TestingPrefServiceSimple pref_service_; | 122 TestingPrefServiceSimple pref_service_; |
| 123 scoped_ptr<TestingHttpServerPropertiesManager> http_server_props_manager_; | 123 scoped_ptr<TestingHttpServerPropertiesManager> http_server_props_manager_; |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 content::TestBrowserThread ui_thread_; | 126 content::TestBrowserThread ui_thread_; |
| 127 content::TestBrowserThread io_thread_; | 127 content::TestBrowserThread io_thread_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManagerTest); | 129 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManagerTest); |
| 130 }; | 130 }; |
| 131 | 131 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 EXPECT_EQ(value1, flags_and_value1_ret.second); | 350 EXPECT_EQ(value1, flags_and_value1_ret.second); |
| 351 | 351 |
| 352 EXPECT_EQ(net::PIPELINE_CAPABLE, | 352 EXPECT_EQ(net::PIPELINE_CAPABLE, |
| 353 http_server_props_manager_->GetPipelineCapability(known_pipeliner)); | 353 http_server_props_manager_->GetPipelineCapability(known_pipeliner)); |
| 354 | 354 |
| 355 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 355 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
| 356 | 356 |
| 357 ExpectPrefsUpdate(); | 357 ExpectPrefsUpdate(); |
| 358 | 358 |
| 359 // Clear http server data, time out if we do not get a completion callback. | 359 // Clear http server data, time out if we do not get a completion callback. |
| 360 http_server_props_manager_->Clear(MessageLoop::QuitClosure()); | 360 http_server_props_manager_->Clear(base::MessageLoop::QuitClosure()); |
| 361 loop_.Run(); | 361 loop_.Run(); |
| 362 | 362 |
| 363 EXPECT_FALSE(http_server_props_manager_->SupportsSpdy(spdy_server_mail)); | 363 EXPECT_FALSE(http_server_props_manager_->SupportsSpdy(spdy_server_mail)); |
| 364 EXPECT_FALSE( | 364 EXPECT_FALSE( |
| 365 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail)); | 365 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail)); |
| 366 | 366 |
| 367 const net::SettingsMap& settings_map2_ret = | 367 const net::SettingsMap& settings_map2_ret = |
| 368 http_server_props_manager_->GetSpdySettings(spdy_server_mail); | 368 http_server_props_manager_->GetSpdySettings(spdy_server_mail); |
| 369 EXPECT_EQ(0U, settings_map2_ret.size()); | 369 EXPECT_EQ(0U, settings_map2_ret.size()); |
| 370 | 370 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // Run the task after shutdown, but before deletion. | 441 // Run the task after shutdown, but before deletion. |
| 442 loop_.RunUntilIdle(); | 442 loop_.RunUntilIdle(); |
| 443 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 443 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
| 444 http_server_props_manager_.reset(); | 444 http_server_props_manager_.reset(); |
| 445 loop_.RunUntilIdle(); | 445 loop_.RunUntilIdle(); |
| 446 } | 446 } |
| 447 | 447 |
| 448 } // namespace | 448 } // namespace |
| 449 | 449 |
| 450 } // namespace chrome_browser_net | 450 } // namespace chrome_browser_net |
| OLD | NEW |