| 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/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 ExpectPrefsUpdate(); | 572 ExpectPrefsUpdate(); |
| 573 ExpectScheduleUpdatePrefsOnNetworkThread(); | 573 ExpectScheduleUpdatePrefsOnNetworkThread(); |
| 574 | 574 |
| 575 HostPortPair mail_server("mail.google.com", 80); | 575 HostPortPair mail_server("mail.google.com", 80); |
| 576 const ServerNetworkStats* stats = | 576 const ServerNetworkStats* stats = |
| 577 http_server_props_manager_->GetServerNetworkStats(mail_server); | 577 http_server_props_manager_->GetServerNetworkStats(mail_server); |
| 578 EXPECT_EQ(NULL, stats); | 578 EXPECT_EQ(NULL, stats); |
| 579 ServerNetworkStats stats1; | 579 ServerNetworkStats stats1; |
| 580 stats1.srtt = base::TimeDelta::FromMicroseconds(10); | 580 stats1.srtt = base::TimeDelta::FromMicroseconds(10); |
| 581 http_server_props_manager_->SetServerNetworkStats(mail_server, stats1); | 581 http_server_props_manager_->SetServerNetworkStats(mail_server, stats1); |
| 582 // ExpectScheduleUpdatePrefsOnNetworkThread() should be called only once. |
| 583 http_server_props_manager_->SetServerNetworkStats(mail_server, stats1); |
| 582 | 584 |
| 583 // Run the task. | 585 // Run the task. |
| 584 base::RunLoop().RunUntilIdle(); | 586 base::RunLoop().RunUntilIdle(); |
| 585 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 587 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
| 586 | 588 |
| 587 const ServerNetworkStats* stats2 = | 589 const ServerNetworkStats* stats2 = |
| 588 http_server_props_manager_->GetServerNetworkStats(mail_server); | 590 http_server_props_manager_->GetServerNetworkStats(mail_server); |
| 589 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); | 591 EXPECT_EQ(10, stats2->srtt.ToInternalValue()); |
| 590 } | 592 } |
| 591 | 593 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 // Run the task after shutdown, but before deletion. | 841 // Run the task after shutdown, but before deletion. |
| 840 base::RunLoop().RunUntilIdle(); | 842 base::RunLoop().RunUntilIdle(); |
| 841 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 843 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
| 842 http_server_props_manager_.reset(); | 844 http_server_props_manager_.reset(); |
| 843 base::RunLoop().RunUntilIdle(); | 845 base::RunLoop().RunUntilIdle(); |
| 844 } | 846 } |
| 845 | 847 |
| 846 } // namespace | 848 } // namespace |
| 847 | 849 |
| 848 } // namespace net | 850 } // namespace net |
| OLD | NEW |