OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/gdata/gdata_util.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 ExtractGDataPath( | 44 ExtractGDataPath( |
45 FilePath::FromUTF8Unsafe("/special/gdata"))); | 45 FilePath::FromUTF8Unsafe("/special/gdata"))); |
46 EXPECT_EQ(FilePath::FromUTF8Unsafe("gdata/foo.txt"), | 46 EXPECT_EQ(FilePath::FromUTF8Unsafe("gdata/foo.txt"), |
47 ExtractGDataPath( | 47 ExtractGDataPath( |
48 FilePath::FromUTF8Unsafe("/special/gdata/foo.txt"))); | 48 FilePath::FromUTF8Unsafe("/special/gdata/foo.txt"))); |
49 EXPECT_EQ(FilePath::FromUTF8Unsafe("gdata/subdir/foo.txt"), | 49 EXPECT_EQ(FilePath::FromUTF8Unsafe("gdata/subdir/foo.txt"), |
50 ExtractGDataPath( | 50 ExtractGDataPath( |
51 FilePath::FromUTF8Unsafe("/special/gdata/subdir/foo.txt"))); | 51 FilePath::FromUTF8Unsafe("/special/gdata/subdir/foo.txt"))); |
52 } | 52 } |
53 | 53 |
54 TEST(GDataUtilTest, ParseCacheFilePath) { | |
55 std::string resource_id, md5, extra_suffix; | |
56 ParseCacheFilePath( | |
57 FilePath::FromUTF8Unsafe( | |
58 "/home/user/GCache/v1/persistent/pdf:a1b2.0123456789abcdef.mounted"), | |
59 &resource_id, | |
60 &md5, | |
61 &extra_suffix); | |
62 EXPECT_EQ(resource_id, "pdf:a1b2"); | |
satorux1
2012/04/20 21:46:10
seems to me that "pdf:" shouldn't be part of the r
hshi
2012/04/20 22:04:51
I also assumed "pdf:" is not part of resource id i
satorux1
2012/04/20 22:27:20
You are right. would be nice to mention it in the
| |
63 EXPECT_EQ(md5, "0123456789abcdef"); | |
64 EXPECT_EQ(extra_suffix, "mounted"); | |
65 | |
66 ParseCacheFilePath( | |
67 FilePath::FromUTF8Unsafe( | |
68 "/home/user/GCache/v1/tmp/pdf:a1b2.0123456789abcdef"), | |
69 &resource_id, | |
70 &md5, | |
71 &extra_suffix); | |
72 EXPECT_EQ(resource_id, "pdf:a1b2"); | |
73 EXPECT_EQ(md5, "0123456789abcdef"); | |
74 EXPECT_EQ(extra_suffix, ""); | |
75 | |
76 ParseCacheFilePath( | |
77 FilePath::FromUTF8Unsafe( | |
78 "/home/user/GCache/v1/pinned/pdf:a1b2"), | |
79 &resource_id, | |
80 &md5, | |
81 &extra_suffix); | |
82 EXPECT_EQ(resource_id, "pdf:a1b2"); | |
83 EXPECT_EQ(md5, ""); | |
84 EXPECT_EQ(extra_suffix, ""); | |
85 } | |
86 | |
54 } // namespace util | 87 } // namespace util |
55 } // namespace gdata | 88 } // namespace gdata |
OLD | NEW |