summaryrefslogtreecommitdiffstats
path: root/net/log/net_log_capture_mode_unittest.cc
blob: a249bf1e011ebc8eb9b5f028dfe862b6f2837f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/log/net_log_capture_mode.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace net {

namespace {

TEST(NetLogCaptureMode, DefaultConstructor) {
  EXPECT_EQ(NetLogCaptureMode(), NetLogCaptureMode::Default());
}

TEST(NetLogCaptureMode, Default) {
  NetLogCaptureMode mode = NetLogCaptureMode::Default();

  EXPECT_FALSE(mode.include_cookies_and_credentials());
  EXPECT_FALSE(mode.include_socket_bytes());

  EXPECT_EQ(mode, NetLogCaptureMode::Default());
  EXPECT_NE(mode, NetLogCaptureMode::IncludeCookiesAndCredentials());
  EXPECT_NE(mode, NetLogCaptureMode::IncludeSocketBytes());
}

TEST(NetLogCaptureMode, IncludeCookiesAndCredentials) {
  NetLogCaptureMode mode = NetLogCaptureMode::IncludeCookiesAndCredentials();

  EXPECT_TRUE(mode.include_cookies_and_credentials());
  EXPECT_FALSE(mode.include_socket_bytes());

  EXPECT_NE(mode, NetLogCaptureMode::Default());
  EXPECT_EQ(mode, NetLogCaptureMode::IncludeCookiesAndCredentials());
  EXPECT_NE(mode, NetLogCaptureMode::IncludeSocketBytes());
}

TEST(NetLogCaptureMode, IncludeSocketBytes) {
  NetLogCaptureMode mode = NetLogCaptureMode::IncludeSocketBytes();

  EXPECT_TRUE(mode.include_cookies_and_credentials());
  EXPECT_TRUE(mode.include_socket_bytes());

  EXPECT_NE(mode, NetLogCaptureMode::Default());
  EXPECT_NE(mode, NetLogCaptureMode::IncludeCookiesAndCredentials());
  EXPECT_EQ(mode, NetLogCaptureMode::IncludeSocketBytes());
}

}  // namespace

}  // namespace net