OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/net_log.h" | 5 #include "net/log/net_log.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 return 1; | 36 return 1; |
37 if (capture_mode == NetLogCaptureMode::IncludeSocketBytes()) | 37 if (capture_mode == NetLogCaptureMode::IncludeSocketBytes()) |
38 return 2; | 38 return 2; |
39 | 39 |
40 ADD_FAILURE() << "Unknown capture mode"; | 40 ADD_FAILURE() << "Unknown capture mode"; |
41 return -1; | 41 return -1; |
42 } | 42 } |
43 | 43 |
44 std::unique_ptr<base::Value> CaptureModeToValue( | 44 std::unique_ptr<base::Value> CaptureModeToValue( |
45 NetLogCaptureMode capture_mode) { | 45 NetLogCaptureMode capture_mode) { |
46 return base::MakeUnique<base::FundamentalValue>( | 46 return base::MakeUnique<base::Value>(CaptureModeToInt(capture_mode)); |
47 CaptureModeToInt(capture_mode)); | |
48 } | 47 } |
49 | 48 |
50 std::unique_ptr<base::Value> NetCaptureModeCallback( | 49 std::unique_ptr<base::Value> NetCaptureModeCallback( |
51 NetLogCaptureMode capture_mode) { | 50 NetLogCaptureMode capture_mode) { |
52 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 51 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
53 dict->Set("capture_mode", CaptureModeToValue(capture_mode)); | 52 dict->Set("capture_mode", CaptureModeToValue(capture_mode)); |
54 return std::move(dict); | 53 return std::move(dict); |
55 } | 54 } |
56 | 55 |
57 TEST(NetLogTest, Basic) { | 56 TEST(NetLogTest, Basic) { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 NetLog net_log; | 397 NetLog net_log; |
399 | 398 |
400 // Run a bunch of threads to completion, each of which will repeatedly add | 399 // Run a bunch of threads to completion, each of which will repeatedly add |
401 // and remove an observer, and set its logging level. | 400 // and remove an observer, and set its logging level. |
402 RunTestThreads<AddRemoveObserverTestThread>(&net_log); | 401 RunTestThreads<AddRemoveObserverTestThread>(&net_log); |
403 } | 402 } |
404 | 403 |
405 } // namespace | 404 } // namespace |
406 | 405 |
407 } // namespace net | 406 } // namespace net |
OLD | NEW |