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

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

Issue 1109473003: Get rid of TestNetLog::CapturedEntry[List] typedefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 (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_unittest.h" 5 #include "net/log/net_log_unittest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 base::Value* NetCaptureModeCallback(NetLogCaptureMode capture_mode) { 25 base::Value* NetCaptureModeCallback(NetLogCaptureMode capture_mode) {
26 base::DictionaryValue* dict = new base::DictionaryValue(); 26 base::DictionaryValue* dict = new base::DictionaryValue();
27 dict->Set("capture_mode", CaptureModeToValue(capture_mode)); 27 dict->Set("capture_mode", CaptureModeToValue(capture_mode));
28 return dict; 28 return dict;
29 } 29 }
30 30
31 TEST(NetLogTest, Basic) { 31 TEST(NetLogTest, Basic) {
32 TestNetLog net_log; 32 TestNetLog net_log;
33 TestNetLog::CapturedEntryList entries; 33 CapturedNetLogEntry::List entries;
34 net_log.GetEntries(&entries); 34 net_log.GetEntries(&entries);
35 EXPECT_EQ(0u, entries.size()); 35 EXPECT_EQ(0u, entries.size());
36 36
37 net_log.AddGlobalEntry(NetLog::TYPE_CANCELLED); 37 net_log.AddGlobalEntry(NetLog::TYPE_CANCELLED);
38 38
39 net_log.GetEntries(&entries); 39 net_log.GetEntries(&entries);
40 ASSERT_EQ(1u, entries.size()); 40 ASSERT_EQ(1u, entries.size());
41 EXPECT_EQ(NetLog::TYPE_CANCELLED, entries[0].type); 41 EXPECT_EQ(NetLog::TYPE_CANCELLED, entries[0].type);
42 EXPECT_EQ(NetLog::SOURCE_NONE, entries[0].source.type); 42 EXPECT_EQ(NetLog::SOURCE_NONE, entries[0].source.type);
43 EXPECT_NE(NetLog::Source::kInvalidId, entries[0].source.id); 43 EXPECT_NE(NetLog::Source::kInvalidId, entries[0].source.id);
(...skipping 12 matching lines...) Expand all
56 56
57 TestNetLog net_log; 57 TestNetLog net_log;
58 58
59 for (NetLogCaptureMode mode : kModes) { 59 for (NetLogCaptureMode mode : kModes) {
60 net_log.SetCaptureMode(mode); 60 net_log.SetCaptureMode(mode);
61 EXPECT_EQ(mode, net_log.GetCaptureMode()); 61 EXPECT_EQ(mode, net_log.GetCaptureMode());
62 62
63 net_log.AddGlobalEntry(NetLog::TYPE_SOCKET_ALIVE, 63 net_log.AddGlobalEntry(NetLog::TYPE_SOCKET_ALIVE,
64 base::Bind(NetCaptureModeCallback)); 64 base::Bind(NetCaptureModeCallback));
65 65
66 TestNetLog::CapturedEntryList entries; 66 CapturedNetLogEntry::List entries;
67 net_log.GetEntries(&entries); 67 net_log.GetEntries(&entries);
68 68
69 ASSERT_EQ(1u, entries.size()); 69 ASSERT_EQ(1u, entries.size());
70 EXPECT_EQ(NetLog::TYPE_SOCKET_ALIVE, entries[0].type); 70 EXPECT_EQ(NetLog::TYPE_SOCKET_ALIVE, entries[0].type);
71 EXPECT_EQ(NetLog::SOURCE_NONE, entries[0].source.type); 71 EXPECT_EQ(NetLog::SOURCE_NONE, entries[0].source.type);
72 EXPECT_NE(NetLog::Source::kInvalidId, entries[0].source.id); 72 EXPECT_NE(NetLog::Source::kInvalidId, entries[0].source.id);
73 EXPECT_EQ(NetLog::PHASE_NONE, entries[0].phase); 73 EXPECT_EQ(NetLog::PHASE_NONE, entries[0].phase);
74 EXPECT_GE(base::TimeTicks::Now(), entries[0].time); 74 EXPECT_GE(base::TimeTicks::Now(), entries[0].time);
75 75
76 int logged_capture_mode; 76 int logged_capture_mode;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 NetLog net_log; 370 NetLog net_log;
371 371
372 // Run a bunch of threads to completion, each of which will repeatedly add 372 // Run a bunch of threads to completion, each of which will repeatedly add
373 // and remove an observer, and set its logging level. 373 // and remove an observer, and set its logging level.
374 RunTestThreads<AddRemoveObserverTestThread>(&net_log); 374 RunTestThreads<AddRemoveObserverTestThread>(&net_log);
375 } 375 }
376 376
377 } // namespace 377 } // namespace
378 378
379 } // namespace net 379 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698