OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/file_net_log_observer.h" | 5 #include "net/log/file_net_log_observer.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 ASSERT_TRUE(ReadNetLogFromDisk(&root, &events)); | 327 ASSERT_TRUE(ReadNetLogFromDisk(&root, &events)); |
328 | 328 |
329 // Check that there is 1 event written. | 329 // Check that there is 1 event written. |
330 ASSERT_EQ(1u, events->GetSize()); | 330 ASSERT_EQ(1u, events->GetSize()); |
331 } | 331 } |
332 | 332 |
333 TEST_P(FileNetLogObserverTest, CustomConstants) { | 333 TEST_P(FileNetLogObserverTest, CustomConstants) { |
334 TestClosure closure; | 334 TestClosure closure; |
335 | 335 |
336 const char kConstantString[] = "awesome constant"; | 336 const char kConstantString[] = "awesome constant"; |
337 std::unique_ptr<base::Value> constants( | 337 std::unique_ptr<base::Value> constants(new base::Value(kConstantString)); |
338 new base::StringValue(kConstantString)); | |
339 | 338 |
340 CreateAndStartObserving(std::move(constants)); | 339 CreateAndStartObserving(std::move(constants)); |
341 | 340 |
342 logger_->StopObserving(nullptr, closure.closure()); | 341 logger_->StopObserving(nullptr, closure.closure()); |
343 | 342 |
344 closure.WaitForResult(); | 343 closure.WaitForResult(); |
345 | 344 |
346 std::unique_ptr<base::Value> root; | 345 std::unique_ptr<base::Value> root; |
347 base::ListValue* events; | 346 base::ListValue* events; |
348 ASSERT_TRUE(ReadNetLogFromDisk(&root, &events)); | 347 ASSERT_TRUE(ReadNetLogFromDisk(&root, &events)); |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 // Check that there are events written to all files. | 787 // Check that there are events written to all files. |
789 for (int i = 0; i < kTotalNumFiles; i++) { | 788 for (int i = 0; i < kTotalNumFiles; i++) { |
790 ASSERT_GE(GetFileSize(GetEventFilePath(i)), | 789 ASSERT_GE(GetFileSize(GetEventFilePath(i)), |
791 static_cast<int64_t>(kEventSize)); | 790 static_cast<int64_t>(kEventSize)); |
792 } | 791 } |
793 } | 792 } |
794 | 793 |
795 } // namespace | 794 } // namespace |
796 | 795 |
797 } // namespace net | 796 } // namespace net |
OLD | NEW |