| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/simple_thread.h" | 12 #include "base/threading/simple_thread.h" |
| 11 #include "base/values.h" | 13 #include "base/values.h" |
| 12 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 13 #include "net/log/test_net_log.h" | 15 #include "net/log/test_net_log.h" |
| 14 #include "net/log/test_net_log_entry.h" | 16 #include "net/log/test_net_log_entry.h" |
| 15 #include "net/log/test_net_log_util.h" | 17 #include "net/log/test_net_log_util.h" |
| 16 | 18 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 37 } | 39 } |
| 38 | 40 |
| 39 scoped_ptr<base::Value> CaptureModeToValue(NetLogCaptureMode capture_mode) { | 41 scoped_ptr<base::Value> CaptureModeToValue(NetLogCaptureMode capture_mode) { |
| 40 return make_scoped_ptr( | 42 return make_scoped_ptr( |
| 41 new base::FundamentalValue(CaptureModeToInt(capture_mode))); | 43 new base::FundamentalValue(CaptureModeToInt(capture_mode))); |
| 42 } | 44 } |
| 43 | 45 |
| 44 scoped_ptr<base::Value> NetCaptureModeCallback(NetLogCaptureMode capture_mode) { | 46 scoped_ptr<base::Value> NetCaptureModeCallback(NetLogCaptureMode capture_mode) { |
| 45 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 47 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 46 dict->Set("capture_mode", CaptureModeToValue(capture_mode)); | 48 dict->Set("capture_mode", CaptureModeToValue(capture_mode)); |
| 47 return dict.Pass(); | 49 return std::move(dict); |
| 48 } | 50 } |
| 49 | 51 |
| 50 TEST(NetLogTest, Basic) { | 52 TEST(NetLogTest, Basic) { |
| 51 TestNetLog net_log; | 53 TestNetLog net_log; |
| 52 TestNetLogEntry::List entries; | 54 TestNetLogEntry::List entries; |
| 53 net_log.GetEntries(&entries); | 55 net_log.GetEntries(&entries); |
| 54 EXPECT_EQ(0u, entries.size()); | 56 EXPECT_EQ(0u, entries.size()); |
| 55 | 57 |
| 56 net_log.AddGlobalEntry(NetLog::TYPE_CANCELLED); | 58 net_log.AddGlobalEntry(NetLog::TYPE_CANCELLED); |
| 57 | 59 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 NetLog net_log; | 391 NetLog net_log; |
| 390 | 392 |
| 391 // Run a bunch of threads to completion, each of which will repeatedly add | 393 // Run a bunch of threads to completion, each of which will repeatedly add |
| 392 // and remove an observer, and set its logging level. | 394 // and remove an observer, and set its logging level. |
| 393 RunTestThreads<AddRemoveObserverTestThread>(&net_log); | 395 RunTestThreads<AddRemoveObserverTestThread>(&net_log); |
| 394 } | 396 } |
| 395 | 397 |
| 396 } // namespace | 398 } // namespace |
| 397 | 399 |
| 398 } // namespace net | 400 } // namespace net |
| OLD | NEW |