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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 void ExpectPrefsUpdateRepeatedly() { | 121 void ExpectPrefsUpdateRepeatedly() { |
122 EXPECT_CALL(*http_server_props_manager_, UpdatePrefsFromCacheOnIO(_)) | 122 EXPECT_CALL(*http_server_props_manager_, UpdatePrefsFromCacheOnIO(_)) |
123 .WillRepeatedly( | 123 .WillRepeatedly( |
124 Invoke(http_server_props_manager_.get(), | 124 Invoke(http_server_props_manager_.get(), |
125 &TestingHttpServerPropertiesManager:: | 125 &TestingHttpServerPropertiesManager:: |
126 UpdatePrefsFromCacheOnIOConcrete)); | 126 UpdatePrefsFromCacheOnIOConcrete)); |
127 } | 127 } |
128 | 128 |
129 MessageLoop loop_; | 129 base::MessageLoop loop_; |
130 TestingPrefServiceSimple pref_service_; | 130 TestingPrefServiceSimple pref_service_; |
131 scoped_ptr<TestingHttpServerPropertiesManager> http_server_props_manager_; | 131 scoped_ptr<TestingHttpServerPropertiesManager> http_server_props_manager_; |
132 | 132 |
133 private: | 133 private: |
134 content::TestBrowserThread ui_thread_; | 134 content::TestBrowserThread ui_thread_; |
135 content::TestBrowserThread io_thread_; | 135 content::TestBrowserThread io_thread_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManagerTest); | 137 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManagerTest); |
138 }; | 138 }; |
139 | 139 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 EXPECT_EQ(value1, flags_and_value1_ret.second); | 433 EXPECT_EQ(value1, flags_and_value1_ret.second); |
434 | 434 |
435 EXPECT_EQ(net::PIPELINE_CAPABLE, | 435 EXPECT_EQ(net::PIPELINE_CAPABLE, |
436 http_server_props_manager_->GetPipelineCapability(known_pipeliner)); | 436 http_server_props_manager_->GetPipelineCapability(known_pipeliner)); |
437 | 437 |
438 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 438 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
439 | 439 |
440 ExpectPrefsUpdate(); | 440 ExpectPrefsUpdate(); |
441 | 441 |
442 // Clear http server data, time out if we do not get a completion callback. | 442 // Clear http server data, time out if we do not get a completion callback. |
443 http_server_props_manager_->Clear(MessageLoop::QuitClosure()); | 443 http_server_props_manager_->Clear(base::MessageLoop::QuitClosure()); |
444 loop_.Run(); | 444 loop_.Run(); |
445 | 445 |
446 EXPECT_FALSE(http_server_props_manager_->SupportsSpdy(spdy_server_mail)); | 446 EXPECT_FALSE(http_server_props_manager_->SupportsSpdy(spdy_server_mail)); |
447 EXPECT_FALSE( | 447 EXPECT_FALSE( |
448 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail)); | 448 http_server_props_manager_->HasAlternateProtocol(spdy_server_mail)); |
449 | 449 |
450 const net::SettingsMap& settings_map2_ret = | 450 const net::SettingsMap& settings_map2_ret = |
451 http_server_props_manager_->GetSpdySettings(spdy_server_mail); | 451 http_server_props_manager_->GetSpdySettings(spdy_server_mail); |
452 EXPECT_EQ(0U, settings_map2_ret.size()); | 452 EXPECT_EQ(0U, settings_map2_ret.size()); |
453 | 453 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 // Run the task after shutdown, but before deletion. | 524 // Run the task after shutdown, but before deletion. |
525 loop_.RunUntilIdle(); | 525 loop_.RunUntilIdle(); |
526 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 526 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
527 http_server_props_manager_.reset(); | 527 http_server_props_manager_.reset(); |
528 loop_.RunUntilIdle(); | 528 loop_.RunUntilIdle(); |
529 } | 529 } |
530 | 530 |
531 } // namespace | 531 } // namespace |
532 | 532 |
533 } // namespace chrome_browser_net | 533 } // namespace chrome_browser_net |
OLD | NEW |