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

Side by Side Diff: components/metrics/serialization/serialization_utils_unittest.cc

Issue 684513002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/metrics/serialization/serialization_utils.h" 5 #include "components/metrics/serialization/serialization_utils.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "components/metrics/serialization/metric_sample.h" 11 #include "components/metrics/serialization/metric_sample.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace metrics { 14 namespace metrics {
15 namespace { 15 namespace {
16 16
17 class SerializationUtilsTest : public testing::Test { 17 class SerializationUtilsTest : public testing::Test {
18 protected: 18 protected:
19 SerializationUtilsTest() { 19 SerializationUtilsTest() {
20 bool success = temporary_dir.CreateUniqueTempDir(); 20 bool success = temporary_dir.CreateUniqueTempDir();
21 if (success) { 21 if (success) {
22 base::FilePath dir_path = temporary_dir.path(); 22 base::FilePath dir_path = temporary_dir.path();
23 filename = dir_path.value() + "chromeossampletest"; 23 filename = dir_path.value() + "chromeossampletest";
24 filepath = base::FilePath(filename); 24 filepath = base::FilePath(filename);
25 } 25 }
26 } 26 }
27 27
28 virtual void SetUp() override { 28 void SetUp() override { base::DeleteFile(filepath, false); }
29 base::DeleteFile(filepath, false);
30 }
31 29
32 void TestSerialization(MetricSample* sample) { 30 void TestSerialization(MetricSample* sample) {
33 std::string serialized(sample->ToString()); 31 std::string serialized(sample->ToString());
34 ASSERT_EQ('\0', serialized[serialized.length() - 1]); 32 ASSERT_EQ('\0', serialized[serialized.length() - 1]);
35 scoped_ptr<MetricSample> deserialized = 33 scoped_ptr<MetricSample> deserialized =
36 SerializationUtils::ParseSample(serialized); 34 SerializationUtils::ParseSample(serialized);
37 ASSERT_TRUE(deserialized); 35 ASSERT_TRUE(deserialized);
38 EXPECT_TRUE(sample->IsEqual(*deserialized.get())); 36 EXPECT_TRUE(sample->IsEqual(*deserialized.get()));
39 } 37 }
40 38
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 EXPECT_TRUE(shist->IsEqual(*vect[3])); 159 EXPECT_TRUE(shist->IsEqual(*vect[3]));
162 EXPECT_TRUE(action->IsEqual(*vect[4])); 160 EXPECT_TRUE(action->IsEqual(*vect[4]));
163 161
164 int64 size = 0; 162 int64 size = 0;
165 ASSERT_TRUE(base::GetFileSize(filepath, &size)); 163 ASSERT_TRUE(base::GetFileSize(filepath, &size));
166 ASSERT_EQ(0, size); 164 ASSERT_EQ(0, size);
167 } 165 }
168 166
169 } // namespace 167 } // namespace
170 } // namespace metrics 168 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_service_unittest.cc ('k') | components/nacl/browser/nacl_file_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698