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

Side by Side Diff: chrome/browser/net/net_log_temp_file_unittest.cc

Issue 684613002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "chrome/browser/net/net_log_temp_file.h" 5 #include "chrome/browser/net/net_log_temp_file.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 class NetLogTempFileTest : public ::testing::Test { 54 class NetLogTempFileTest : public ::testing::Test {
55 public: 55 public:
56 NetLogTempFileTest() 56 NetLogTempFileTest()
57 : net_log_(new ChromeNetLog), 57 : net_log_(new ChromeNetLog),
58 net_log_temp_file_(new TestNetLogTempFile(net_log_.get())), 58 net_log_temp_file_(new TestNetLogTempFile(net_log_.get())),
59 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, 59 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING,
60 &message_loop_) { 60 &message_loop_) {
61 } 61 }
62 62
63 // ::testing::Test implementation: 63 // ::testing::Test implementation:
64 virtual void SetUp() override { 64 void SetUp() override {
65 // Get a temporary file name for unit tests. 65 // Get a temporary file name for unit tests.
66 base::FilePath net_log_dir; 66 base::FilePath net_log_dir;
67 ASSERT_TRUE(net_log_temp_file_->GetNetExportLogDirectory(&net_log_dir)); 67 ASSERT_TRUE(net_log_temp_file_->GetNetExportLogDirectory(&net_log_dir));
68 ASSERT_TRUE(base::CreateTemporaryFileInDir(net_log_dir, &net_export_log_)); 68 ASSERT_TRUE(base::CreateTemporaryFileInDir(net_log_dir, &net_export_log_));
69 69
70 net_log_temp_file_->log_filename_ = net_export_log_.BaseName().value(); 70 net_log_temp_file_->log_filename_ = net_export_log_.BaseName().value();
71 71
72 // CreateTemporaryFileInDir may return a legacy 8.3 file name on windows. 72 // CreateTemporaryFileInDir may return a legacy 8.3 file name on windows.
73 // Need to use the original directory name for string comparisons. 73 // Need to use the original directory name for string comparisons.
74 ASSERT_TRUE(net_log_temp_file_->GetNetExportLog()); 74 ASSERT_TRUE(net_log_temp_file_->GetNetExportLog());
75 net_export_log_ = net_log_temp_file_->log_path_; 75 net_export_log_ = net_log_temp_file_->log_path_;
76 ASSERT_FALSE(net_export_log_.empty()); 76 ASSERT_FALSE(net_export_log_.empty());
77 } 77 }
78 78
79 virtual void TearDown() override { 79 void TearDown() override {
80 // Delete the temporary file we have created. 80 // Delete the temporary file we have created.
81 ASSERT_TRUE(base::DeleteFile(net_export_log_, false)); 81 ASSERT_TRUE(base::DeleteFile(net_export_log_, false));
82 } 82 }
83 83
84 std::string GetStateString() const { 84 std::string GetStateString() const {
85 scoped_ptr<base::DictionaryValue> dict(net_log_temp_file_->GetState()); 85 scoped_ptr<base::DictionaryValue> dict(net_log_temp_file_->GetState());
86 std::string state; 86 std::string state;
87 EXPECT_TRUE(dict->GetString("state", &state)); 87 EXPECT_TRUE(dict->GetString("state", &state));
88 return state; 88 return state;
89 } 89 }
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // Log an event. 342 // Log an event.
343 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); 343 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED);
344 344
345 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); 345 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP);
346 VerifyFileAndStateAfterDoStop(); 346 VerifyFileAndStateAfterDoStop();
347 347
348 int64 new_stop_file_size; 348 int64 new_stop_file_size;
349 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); 349 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size));
350 EXPECT_GE(new_stop_file_size, stop_file_size); 350 EXPECT_GE(new_stop_file_size, stop_file_size);
351 } 351 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698