Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: components/net_log/net_log_file_writer_unittest.cc

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "components/net_log/net_log_file_writer.h" 5 #include "components/net_log/net_log_file_writer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_file.h" 14 #include "base/files/scoped_file.h"
15 #include "base/files/scoped_temp_dir.h" 15 #include "base/files/scoped_temp_dir.h"
16 #include "base/json/json_reader.h" 16 #include "base/json/json_reader.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "components/net_log/chrome_net_log.h" 20 #include "components/net_log/chrome_net_log.h"
21 #include "net/log/net_log_capture_mode.h" 21 #include "net/log/net_log_capture_mode.h"
22 #include "net/log/net_log_event_type.h"
22 #include "net/log/write_to_file_net_log_observer.h" 23 #include "net/log/write_to_file_net_log_observer.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
25 namespace { 26 namespace {
26 27
27 const char kChannelString[] = "SomeChannel"; 28 const char kChannelString[] = "SomeChannel";
28 29
29 } // namespace 30 } // namespace
30 31
31 namespace net_log { 32 namespace net_log {
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 382
382 int64_t stop_file_size; 383 int64_t stop_file_size;
383 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size)); 384 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size));
384 385
385 // Perform DO_START and add an Event and then DO_STOP and then compare 386 // Perform DO_START and add an Event and then DO_STOP and then compare
386 // file sizes. 387 // file sizes.
387 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_START); 388 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_START);
388 VerifyFileAndStateAfterDoStart(); 389 VerifyFileAndStateAfterDoStart();
389 390
390 // Log an event. 391 // Log an event.
391 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); 392 net_log_->AddGlobalEntry(net::NetLogEventType::CANCELLED);
392 393
393 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_STOP); 394 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_STOP);
394 VerifyFileAndStateAfterDoStop(); 395 VerifyFileAndStateAfterDoStop();
395 396
396 int64_t new_stop_file_size; 397 int64_t new_stop_file_size;
397 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); 398 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size));
398 EXPECT_GE(new_stop_file_size, stop_file_size); 399 EXPECT_GE(new_stop_file_size, stop_file_size);
399 } 400 }
400 401
401 TEST_F(NetLogFileWriterTest, CheckAddEventWithCustomPath) { 402 TEST_F(NetLogFileWriterTest, CheckAddEventWithCustomPath) {
(...skipping 23 matching lines...) Expand all
425 426
426 int64_t stop_file_size; 427 int64_t stop_file_size;
427 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size)); 428 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size));
428 429
429 // Perform DO_START and add an Event and then DO_STOP and then compare 430 // Perform DO_START and add an Event and then DO_STOP and then compare
430 // file sizes. 431 // file sizes.
431 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_START); 432 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_START);
432 VerifyFileAndStateAfterDoStart(); 433 VerifyFileAndStateAfterDoStart();
433 434
434 // Log an event. 435 // Log an event.
435 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); 436 net_log_->AddGlobalEntry(net::NetLogEventType::CANCELLED);
436 437
437 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_STOP); 438 net_log_file_writer_->ProcessCommand(NetLogFileWriter::DO_STOP);
438 VerifyFileAndStateAfterDoStop(); 439 VerifyFileAndStateAfterDoStop();
439 440
440 int64_t new_stop_file_size; 441 int64_t new_stop_file_size;
441 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); 442 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size));
442 EXPECT_GE(new_stop_file_size, stop_file_size); 443 EXPECT_GE(new_stop_file_size, stop_file_size);
443 } 444 }
444 445
445 } // namespace net_log 446 } // namespace net_log
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698