Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Side by Side Diff: net/http/http_server_properties_manager_unittest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix platform specific stuff Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 "3.1\"}],\"network_stats\":{\"srtt\":42}},\"www.google.com:80\":" 695 "3.1\"}],\"network_stats\":{\"srtt\":42}},\"www.google.com:80\":"
696 "{\"alternative_service\":[{\"port\":443,\"probability\":1.0," 696 "{\"alternative_service\":[{\"port\":443,\"probability\":1.0,"
697 "\"protocol_str\":\"npn-h2\"}]}},\"supports_quic\":" 697 "\"protocol_str\":\"npn-h2\"}]}},\"supports_quic\":"
698 "{\"address\":\"127.0.0.1\",\"used_quic\":true},\"version\":3}"; 698 "{\"address\":\"127.0.0.1\",\"used_quic\":true},\"version\":3}";
699 699
700 const base::Value* http_server_properties = 700 const base::Value* http_server_properties =
701 pref_service_.GetUserPref(kTestHttpServerProperties); 701 pref_service_.GetUserPref(kTestHttpServerProperties);
702 ASSERT_NE(nullptr, http_server_properties); 702 ASSERT_NE(nullptr, http_server_properties);
703 std::string preferences_json; 703 std::string preferences_json;
704 EXPECT_TRUE( 704 EXPECT_TRUE(
705 base::JSONWriter::Write(http_server_properties, &preferences_json)); 705 base::JSONWriter::Write(*http_server_properties, &preferences_json));
706 EXPECT_EQ(expected_json, preferences_json); 706 EXPECT_EQ(expected_json, preferences_json);
707 } 707 }
708 708
709 TEST_F(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdateCache0) { 709 TEST_F(HttpServerPropertiesManagerTest, ShutdownWithPendingUpdateCache0) {
710 // Post an update task to the UI thread. 710 // Post an update task to the UI thread.
711 http_server_props_manager_->ScheduleUpdateCacheOnPrefThread(); 711 http_server_props_manager_->ScheduleUpdateCacheOnPrefThread();
712 // Shutdown comes before the task is executed. 712 // Shutdown comes before the task is executed.
713 http_server_props_manager_->ShutdownOnPrefThread(); 713 http_server_props_manager_->ShutdownOnPrefThread();
714 http_server_props_manager_.reset(); 714 http_server_props_manager_.reset();
715 // Run the task after shutdown and deletion. 715 // Run the task after shutdown and deletion.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 // Run the task after shutdown, but before deletion. 774 // Run the task after shutdown, but before deletion.
775 base::RunLoop().RunUntilIdle(); 775 base::RunLoop().RunUntilIdle();
776 Mock::VerifyAndClearExpectations(http_server_props_manager_.get()); 776 Mock::VerifyAndClearExpectations(http_server_props_manager_.get());
777 http_server_props_manager_.reset(); 777 http_server_props_manager_.reset();
778 base::RunLoop().RunUntilIdle(); 778 base::RunLoop().RunUntilIdle();
779 } 779 }
780 780
781 } // namespace 781 } // namespace
782 782
783 } // namespace net 783 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698