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

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

Issue 2318033002: c/browser, c/common, components M-N: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Fix ItunesFileUtilTest 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 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "components/metrics/serialization/metric_sample.h" 14 #include "components/metrics/serialization/metric_sample.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace metrics { 17 namespace metrics {
18 namespace { 18 namespace {
19 19
20 class SerializationUtilsTest : public testing::Test { 20 class SerializationUtilsTest : public testing::Test {
21 protected: 21 protected:
22 SerializationUtilsTest() { 22 SerializationUtilsTest() {
23 bool success = temporary_dir.CreateUniqueTempDir(); 23 bool success = temporary_dir.CreateUniqueTempDir();
24 if (success) { 24 if (success) {
25 base::FilePath dir_path = temporary_dir.path(); 25 base::FilePath dir_path = temporary_dir.GetPath();
26 filename = dir_path.value() + "chromeossampletest"; 26 filename = dir_path.value() + "chromeossampletest";
27 filepath = base::FilePath(filename); 27 filepath = base::FilePath(filename);
28 } 28 }
29 } 29 }
30 30
31 void SetUp() override { base::DeleteFile(filepath, false); } 31 void SetUp() override { base::DeleteFile(filepath, false); }
32 32
33 void TestSerialization(MetricSample* sample) { 33 void TestSerialization(MetricSample* sample) {
34 std::string serialized(sample->ToString()); 34 std::string serialized(sample->ToString());
35 ASSERT_EQ('\0', serialized.back()); 35 ASSERT_EQ('\0', serialized.back());
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 EXPECT_TRUE(shist->IsEqual(*vect[3])); 163 EXPECT_TRUE(shist->IsEqual(*vect[3]));
164 EXPECT_TRUE(action->IsEqual(*vect[4])); 164 EXPECT_TRUE(action->IsEqual(*vect[4]));
165 165
166 int64_t size = 0; 166 int64_t size = 0;
167 ASSERT_TRUE(base::GetFileSize(filepath, &size)); 167 ASSERT_TRUE(base::GetFileSize(filepath, &size));
168 ASSERT_EQ(0, size); 168 ASSERT_EQ(0, size);
169 } 169 }
170 170
171 } // namespace 171 } // namespace
172 } // namespace metrics 172 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698