| 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/log/write_to_file_net_log_observer.h" | 5 #include "net/log/write_to_file_net_log_observer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 class WriteToFileNetLogObserverTest : public testing::Test { | 29 class WriteToFileNetLogObserverTest : public testing::Test { |
| 30 public: | 30 public: |
| 31 void SetUp() override { | 31 void SetUp() override { |
| 32 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 32 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 33 log_path_ = temp_dir_.path().AppendASCII("NetLogFile"); | 33 log_path_ = temp_dir_.GetPath().AppendASCII("NetLogFile"); |
| 34 } | 34 } |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 base::ScopedTempDir temp_dir_; | 37 base::ScopedTempDir temp_dir_; |
| 38 base::FilePath log_path_; | 38 base::FilePath log_path_; |
| 39 NetLog net_log_; | 39 NetLog net_log_; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONForNoEvents) { | 42 TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONForNoEvents) { |
| 43 // Create and destroy a logger. | 43 // Create and destroy a logger. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ASSERT_EQ(1u, events->GetSize()); | 243 ASSERT_EQ(1u, events->GetSize()); |
| 244 | 244 |
| 245 // Make sure additional information is present, but don't validate it. | 245 // Make sure additional information is present, but don't validate it. |
| 246 base::DictionaryValue* tab_info; | 246 base::DictionaryValue* tab_info; |
| 247 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info)); | 247 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace | 250 } // namespace |
| 251 | 251 |
| 252 } // namespace net | 252 } // namespace net |
| OLD | NEW |