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/log/trace_net_log_observer.h" | 5 #include "net/log/trace_net_log_observer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 ASSERT_TRUE(trace_value->GetAsList(&trace_events)); | 84 ASSERT_TRUE(trace_value->GetAsList(&trace_events)); |
85 | 85 |
86 trace_events_ = FilterNetLogTraceEvents(*trace_events); | 86 trace_events_ = FilterNetLogTraceEvents(*trace_events); |
87 | 87 |
88 if (!has_more_events) | 88 if (!has_more_events) |
89 run_loop->Quit(); | 89 run_loop->Quit(); |
90 } | 90 } |
91 | 91 |
92 static void EnableTraceLog() { | 92 static void EnableTraceLog() { |
93 TraceLog::GetInstance()->SetEnabled( | 93 TraceLog::GetInstance()->SetEnabled( |
94 base::trace_event::CategoryFilter(kNetLogTracingCategory), | 94 base::trace_event::TraceConfig(kNetLogTracingCategory, ""), |
95 TraceLog::RECORDING_MODE, base::trace_event::TraceOptions()); | 95 TraceLog::RECORDING_MODE); |
96 } | 96 } |
97 | 97 |
98 void EndTraceAndFlush() { | 98 void EndTraceAndFlush() { |
99 base::RunLoop run_loop; | 99 base::RunLoop run_loop; |
100 TraceLog::GetInstance()->SetDisabled(); | 100 TraceLog::GetInstance()->SetDisabled(); |
101 TraceLog::GetInstance()->Flush( | 101 TraceLog::GetInstance()->Flush( |
102 base::Bind(&TraceNetLogObserverTest::OnTraceDataCollected, | 102 base::Bind(&TraceNetLogObserverTest::OnTraceDataCollected, |
103 base::Unretained(this), base::Unretained(&run_loop))); | 103 base::Unretained(this), base::Unretained(&run_loop))); |
104 run_loop.Run(); | 104 run_loop.Run(); |
105 } | 105 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 EXPECT_TRUE(item1->GetString("args.params.foo", &item1_params)); | 364 EXPECT_TRUE(item1->GetString("args.params.foo", &item1_params)); |
365 EXPECT_EQ("bar", item1_params); | 365 EXPECT_EQ("bar", item1_params); |
366 | 366 |
367 EXPECT_TRUE(item2->GetString("args.params", &item2_params)); | 367 EXPECT_TRUE(item2->GetString("args.params", &item2_params)); |
368 EXPECT_TRUE(item2_params.empty()); | 368 EXPECT_TRUE(item2_params.empty()); |
369 } | 369 } |
370 | 370 |
371 } // namespace | 371 } // namespace |
372 | 372 |
373 } // namespace net | 373 } // namespace net |
OLD | NEW |