OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/base/net_log_logger.h" | 5 #include "net/base/net_log_logger.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class NetLogLoggerTest : public testing::Test { | 19 class NetLogLoggerTest : public testing::Test { |
20 public: | 20 public: |
21 virtual void SetUp() { | 21 void SetUp() override { |
22 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 22 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
23 log_path_ = temp_dir_.path().AppendASCII("NetLogFile"); | 23 log_path_ = temp_dir_.path().AppendASCII("NetLogFile"); |
24 } | 24 } |
25 | 25 |
26 protected: | 26 protected: |
27 base::ScopedTempDir temp_dir_; | 27 base::ScopedTempDir temp_dir_; |
28 base::FilePath log_path_; | 28 base::FilePath log_path_; |
29 }; | 29 }; |
30 | 30 |
31 TEST_F(NetLogLoggerTest, GeneratesValidJSONForNoEvents) { | 31 TEST_F(NetLogLoggerTest, GeneratesValidJSONForNoEvents) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 base::DictionaryValue* dict; | 131 base::DictionaryValue* dict; |
132 ASSERT_TRUE(root->GetAsDictionary(&dict)); | 132 ASSERT_TRUE(root->GetAsDictionary(&dict)); |
133 base::ListValue* events; | 133 base::ListValue* events; |
134 ASSERT_TRUE(dict->GetList("events", &events)); | 134 ASSERT_TRUE(dict->GetList("events", &events)); |
135 ASSERT_EQ(2u, events->GetSize()); | 135 ASSERT_EQ(2u, events->GetSize()); |
136 } | 136 } |
137 | 137 |
138 } // namespace | 138 } // namespace |
139 | 139 |
140 } // namespace net | 140 } // namespace net |
OLD | NEW |