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

Side by Side Diff: net/log/bounded_file_net_log_observer_unittest.cc

Issue 2318053004: Remove obsolete QUIC disabling code. (Closed)
Patch Set: fix Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/log/bounded_file_net_log_observer.h" 5 #include "net/log/bounded_file_net_log_observer.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 765
766 logger_->StartObserving(&net_log_, log_path_, nullptr, nullptr, 766 logger_->StartObserving(&net_log_, log_path_, nullptr, nullptr,
767 kLargeFileSize, kTotalNumFiles); 767 kLargeFileSize, kTotalNumFiles);
768 768
769 // Create unique context. 769 // Create unique context.
770 TestURLRequestContext context(true); 770 TestURLRequestContext context(true);
771 context.set_net_log(&net_log_); 771 context.set_net_log(&net_log_);
772 const int kDummyParam = 75; 772 const int kDummyParam = 75;
773 std::unique_ptr<HttpNetworkSession::Params> params( 773 std::unique_ptr<HttpNetworkSession::Params> params(
774 new HttpNetworkSession::Params); 774 new HttpNetworkSession::Params);
775 params->quic_max_number_of_lossy_connections = kDummyParam;
776 params->quic_idle_connection_timeout_seconds = kDummyParam; 775 params->quic_idle_connection_timeout_seconds = kDummyParam;
777 context.set_http_network_session_params(std::move(params)); 776 context.set_http_network_session_params(std::move(params));
778 context.Init(); 777 context.Init();
779 778
780 logger_->StopObserving(&context, closure.closure()); 779 logger_->StopObserving(&context, closure.closure());
781 780
782 closure.WaitForResult(); 781 closure.WaitForResult();
783 782
784 std::string input; 783 std::string input;
785 AddAllFiles(&input); 784 AddAllFiles(&input);
786 ASSERT_FALSE(input.empty()); 785 ASSERT_FALSE(input.empty());
787 786
788 base::JSONReader reader; 787 base::JSONReader reader;
789 std::unique_ptr<base::Value> root(reader.ReadToValue(input)); 788 std::unique_ptr<base::Value> root(reader.ReadToValue(input));
790 ASSERT_TRUE(root) << reader.GetErrorMessage(); 789 ASSERT_TRUE(root) << reader.GetErrorMessage();
791 790
792 // Check that no events were written. 791 // Check that no events were written.
793 base::DictionaryValue* dict; 792 base::DictionaryValue* dict;
794 ASSERT_TRUE(root->GetAsDictionary(&dict)); 793 ASSERT_TRUE(root->GetAsDictionary(&dict));
795 base::ListValue* events; 794 base::ListValue* events;
796 ASSERT_TRUE(dict->GetList("events", &events)); 795 ASSERT_TRUE(dict->GetList("events", &events));
797 ASSERT_EQ(0u, events->GetSize()); 796 ASSERT_EQ(0u, events->GetSize());
798 797
799 // Make sure additional information is present and validate it. 798 // Make sure additional information is present and validate it.
800 base::DictionaryValue* tab_info; 799 base::DictionaryValue* tab_info;
801 base::DictionaryValue* quic_info; 800 base::DictionaryValue* quic_info;
802 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info)); 801 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info));
803 ASSERT_TRUE(tab_info->GetDictionary("quicInfo", &quic_info)); 802 ASSERT_TRUE(tab_info->GetDictionary("quicInfo", &quic_info));
804 base::Value* timeout_value = nullptr; 803 base::Value* timeout_value = nullptr;
805 base::Value* lossy_value = nullptr; 804 int timeout;
806 int timeout, lossy;
807 ASSERT_TRUE( 805 ASSERT_TRUE(
808 quic_info->Get("idle_connection_timeout_seconds", &timeout_value)); 806 quic_info->Get("idle_connection_timeout_seconds", &timeout_value));
809 ASSERT_TRUE(timeout_value->GetAsInteger(&timeout)); 807 ASSERT_TRUE(timeout_value->GetAsInteger(&timeout));
810 ASSERT_EQ(timeout, kDummyParam); 808 ASSERT_EQ(timeout, kDummyParam);
811 ASSERT_TRUE(quic_info->Get("max_number_of_lossy_connections", &lossy_value));
812 ASSERT_TRUE(lossy_value->GetAsInteger(&lossy));
813 ASSERT_EQ(lossy, kDummyParam);
814 } 809 }
815 810
816 TEST_F(BoundedFileNetLogObserverTest, 811 TEST_F(BoundedFileNetLogObserverTest,
817 GeneratesValidJSONWithContextWithActiveRequest) { 812 GeneratesValidJSONWithContextWithActiveRequest) {
818 TestClosure closure; 813 TestClosure closure;
819 814
820 // Create context, start a request. 815 // Create context, start a request.
821 TestURLRequestContext context(true); 816 TestURLRequestContext context(true);
822 context.set_net_log(&net_log_); 817 context.set_net_log(&net_log_);
823 context.Init(); 818 context.Init();
(...skipping 28 matching lines...) Expand all
852 ASSERT_EQ(1u, events->GetSize()); 847 ASSERT_EQ(1u, events->GetSize());
853 848
854 // Make sure additional information is present, but don't validate it. 849 // Make sure additional information is present, but don't validate it.
855 base::DictionaryValue* tab_info; 850 base::DictionaryValue* tab_info;
856 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info)); 851 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info));
857 } 852 }
858 853
859 } // namespace 854 } // namespace
860 855
861 } // namespace net 856 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698