1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/process/process_metrics.h"
10 #include "testing/gtest/include/gtest/gtest.h"
16 // Tests for SystemMetrics.
17 // Exists as a class so it can be a friend of SystemMetrics.
18 class SystemMetricsTest
: public testing::Test
{
20 SystemMetricsTest() {}
23 DISALLOW_COPY_AND_ASSIGN(SystemMetricsTest
);
26 /////////////////////////////////////////////////////////////////////////////
28 #if defined(OS_LINUX) || defined(OS_ANDROID)
29 TEST_F(SystemMetricsTest
, IsValidDiskName
) {
30 std::string invalid_input1
= "";
31 std::string invalid_input2
= "s";
32 std::string invalid_input3
= "sdz+";
33 std::string invalid_input4
= "hda0";
34 std::string invalid_input5
= "mmcbl";
35 std::string invalid_input6
= "mmcblka";
36 std::string invalid_input7
= "mmcblkb";
37 std::string invalid_input8
= "mmmblk0";
39 EXPECT_FALSE(IsValidDiskName(invalid_input1
));
40 EXPECT_FALSE(IsValidDiskName(invalid_input2
));
41 EXPECT_FALSE(IsValidDiskName(invalid_input3
));
42 EXPECT_FALSE(IsValidDiskName(invalid_input4
));
43 EXPECT_FALSE(IsValidDiskName(invalid_input5
));
44 EXPECT_FALSE(IsValidDiskName(invalid_input6
));
45 EXPECT_FALSE(IsValidDiskName(invalid_input7
));
46 EXPECT_FALSE(IsValidDiskName(invalid_input8
));
48 std::string valid_input1
= "sda";
49 std::string valid_input2
= "sdaaaa";
50 std::string valid_input3
= "hdz";
51 std::string valid_input4
= "mmcblk0";
52 std::string valid_input5
= "mmcblk999";
54 EXPECT_TRUE(IsValidDiskName(valid_input1
));
55 EXPECT_TRUE(IsValidDiskName(valid_input2
));
56 EXPECT_TRUE(IsValidDiskName(valid_input3
));
57 EXPECT_TRUE(IsValidDiskName(valid_input4
));
58 EXPECT_TRUE(IsValidDiskName(valid_input5
));
60 #endif // defined(OS_LINUX) || defined(OS_ANDROID)