| 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 "3.1\"}],\"network_stats\":{\"srtt\":42}},\"www.google.com:80\":" | 701 "3.1\"}],\"network_stats\":{\"srtt\":42}},\"www.google.com:80\":" |
| 702 "{\"alternative_service\":[{\"port\":443,\"probability\":1.0," | 702 "{\"alternative_service\":[{\"port\":443,\"probability\":1.0," |
| 703 "\"protocol_str\":\"npn-h2\"}]}},\"supports_quic\":" | 703 "\"protocol_str\":\"npn-h2\"}]}},\"supports_quic\":" |
| 704 "{\"address\":\"127.0.0.1\",\"used_quic\":true},\"version\":3}"; | 704 "{\"address\":\"127.0.0.1\",\"used_quic\":true},\"version\":3}"; |
| 705 | 705 |
| 706 const base::Value* http_server_properties = | 706 const base::Value* http_server_properties = |
| 707 pref_service_.GetUserPref(kTestHttpServerProperties); | 707 pref_service_.GetUserPref(kTestHttpServerProperties); |
| 708 ASSERT_NE(nullptr, http_server_properties); | 708 ASSERT_NE(nullptr, http_server_properties); |
| 709 std::string preferences_json; | 709 std::string preferences_json; |
| 710 EXPECT_TRUE( | 710 EXPECT_TRUE( |
| 711 base::JSONWriter::Write(http_server_properties, &preferences_json)); | 711 base::JSONWriter::Write(*http_server_properties, &preferences_json)); |
| 712 EXPECT_EQ(expected_json, preferences_json); | 712 EXPECT_EQ(expected_json, preferences_json); |
| 713 } | 713 } |
| 714 | 714 |
| 715 TEST_F(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdateCache0) { | 715 TEST_F(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdateCache0) { |
| 716 // Post an update task to the UI thread. | 716 // Post an update task to the UI thread. |
| 717 http_server_props_manager_->ScheduleUpdateCacheOnPrefThread(); | 717 http_server_props_manager_->ScheduleUpdateCacheOnPrefThread(); |
| 718 // Shutdown comes before the task is executed. | 718 // Shutdown comes before the task is executed. |
| 719 http_server_props_manager_->ShutdownOnPrefThread(); | 719 http_server_props_manager_->ShutdownOnPrefThread(); |
| 720 http_server_props_manager_.reset(); | 720 http_server_props_manager_.reset(); |
| 721 // Run the task after shutdown and deletion. | 721 // Run the task after shutdown and deletion. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 // Run the task after shutdown, but before deletion. | 780 // Run the task after shutdown, but before deletion. |
| 781 base::RunLoop().RunUntilIdle(); | 781 base::RunLoop().RunUntilIdle(); |
| 782 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); | 782 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); |
| 783 http_server_props_manager_.reset(); | 783 http_server_props_manager_.reset(); |
| 784 base::RunLoop().RunUntilIdle(); | 784 base::RunLoop().RunUntilIdle(); |
| 785 } | 785 } |
| 786 | 786 |
| 787 } // namespace | 787 } // namespace |
| 788 | 788 |
| 789 } // namespace net | 789 } // namespace net |
| OLD | NEW |