blob: 1496e5d48e81ede983fbf4caf629109e71e0646b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/gdata/gdata_util.h"
#include "base/file_path.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gdata {
namespace util {
TEST(GDataUtilTest, IsUnderGDataMountPoint) {
EXPECT_FALSE(IsUnderGDataMountPoint(
FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
EXPECT_FALSE(IsUnderGDataMountPoint(
FilePath::FromUTF8Unsafe("/special/foo.txt")));
EXPECT_FALSE(IsUnderGDataMountPoint(
FilePath::FromUTF8Unsafe("/special/gdatax/foo.txt")));
EXPECT_FALSE(IsUnderGDataMountPoint(
FilePath::FromUTF8Unsafe("special/gdatax/foo.txt")));
EXPECT_TRUE(IsUnderGDataMountPoint(
FilePath::FromUTF8Unsafe("/special/gdata")));
EXPECT_TRUE(IsUnderGDataMountPoint(
FilePath::FromUTF8Unsafe("/special/gdata/foo.txt")));
EXPECT_TRUE(IsUnderGDataMountPoint(
FilePath::FromUTF8Unsafe("/special/gdata/subdir/foo.txt")));
}
TEST(GDataUtilTest, ExtractGDataPath) {
EXPECT_EQ(FilePath(),
ExtractGDataPath(
FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
EXPECT_EQ(FilePath(),
ExtractGDataPath(
FilePath::FromUTF8Unsafe("/special/foo.txt")));
EXPECT_EQ(FilePath(),
ExtractGDataPath(
FilePath::FromUTF8Unsafe("/special/gdatax/foo.txt")));
EXPECT_EQ(FilePath::FromUTF8Unsafe("gdata"),
ExtractGDataPath(
FilePath::FromUTF8Unsafe("/special/gdata")));
EXPECT_EQ(FilePath::FromUTF8Unsafe("gdata/foo.txt"),
ExtractGDataPath(
FilePath::FromUTF8Unsafe("/special/gdata/foo.txt")));
EXPECT_EQ(FilePath::FromUTF8Unsafe("gdata/subdir/foo.txt"),
ExtractGDataPath(
FilePath::FromUTF8Unsafe("/special/gdata/subdir/foo.txt")));
}
} // namespace util
} // namespace gdata
|