Disable FileSystemProviderApiTest.BigFile
[chromium-blink-merge.git] / net / base / capturing_net_log.h
blob452c9a0657de42a711598fa6f5bf4bc6993a3460
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_BASE_CAPTURING_NET_LOG_H_
6 #define NET_BASE_CAPTURING_NET_LOG_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "net/base/captured_net_log_entry.h"
14 #include "net/base/capturing_net_log_observer.h"
15 #include "net/base/net_log.h"
17 namespace net {
19 // CapturingNetLog is convenience class which combines a NetLog and a
20 // CapturingNetLogObserver. It is intended for testing only, and is part of the
21 // net_test_support project.
22 class CapturingNetLog : public NetLog {
23 public:
24 // TODO(mmenke): Get rid of these.
25 typedef CapturedNetLogEntry CapturedEntry;
26 typedef CapturedNetLogEntry::List CapturedEntryList;
28 CapturingNetLog();
29 ~CapturingNetLog() override;
31 void SetLogLevel(LogLevel log_level);
33 // Below methods are forwarded to capturing_net_log_observer_.
34 void GetEntries(CapturedEntryList* entry_list) const;
35 void GetEntriesForSource(Source source, CapturedEntryList* entry_list) const;
36 size_t GetSize() const;
37 void Clear();
39 private:
40 CapturingNetLogObserver capturing_net_log_observer_;
42 DISALLOW_COPY_AND_ASSIGN(CapturingNetLog);
45 // Helper class that exposes a similar API as BoundNetLog, but uses a
46 // CapturingNetLog rather than the more generic NetLog.
48 // A CapturingBoundNetLog can easily be converted to a BoundNetLog using the
49 // bound() method.
50 class CapturingBoundNetLog {
51 public:
52 CapturingBoundNetLog();
53 ~CapturingBoundNetLog();
55 // The returned BoundNetLog is only valid while |this| is alive.
56 BoundNetLog bound() const { return net_log_; }
58 // Fills |entry_list| with all entries in the log.
59 void GetEntries(CapturingNetLog::CapturedEntryList* entry_list) const;
61 // Fills |entry_list| with all entries in the log from the specified Source.
62 void GetEntriesForSource(
63 NetLog::Source source,
64 CapturingNetLog::CapturedEntryList* entry_list) const;
66 // Returns number of entries in the log.
67 size_t GetSize() const;
69 void Clear();
71 // Sets the log level of the underlying CapturingNetLog.
72 void SetLogLevel(NetLog::LogLevel log_level);
74 private:
75 CapturingNetLog capturing_net_log_;
76 const BoundNetLog net_log_;
78 DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog);
81 } // namespace net
83 #endif // NET_BASE_CAPTURING_NET_LOG_H_