Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / extensions / extension_path_util_unittest.cc
blob3f2200cc942eb61ce131961264f639f854f75d26
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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/path_util.h"
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 using base::FilePath;
13 namespace extensions {
15 // Basic unittest for path_util::PrettifyPath in
16 // chrome/browser/extensions/path_util.cc.
17 // For legacy reasons, it's tested more in
18 // FileSystemApiTest.FileSystemApiGetDisplayPathPrettify.
19 TEST(ExtensionPathUtilTest, BasicPrettifyPathTest) {
20 const FilePath::CharType kHomeShortcut[] = FILE_PATH_LITERAL("~");
22 // Test prettifying empty path.
23 FilePath unprettified;
24 FilePath prettified = path_util::PrettifyPath(unprettified);
25 EXPECT_EQ(unprettified, prettified);
27 // Test home directory ("~").
28 unprettified = base::GetHomeDir();
29 prettified = path_util::PrettifyPath(unprettified);
30 EXPECT_NE(unprettified, prettified);
31 EXPECT_EQ(FilePath(kHomeShortcut), prettified);
33 // Test with one layer ("~/foo").
34 unprettified = unprettified.AppendASCII("foo");
35 prettified = path_util::PrettifyPath(unprettified);
36 EXPECT_NE(unprettified, prettified);
37 EXPECT_EQ(FilePath(kHomeShortcut).AppendASCII("foo"), prettified);
39 // Test with two layers ("~/foo/bar").
40 unprettified = unprettified.AppendASCII("bar");
41 prettified = path_util::PrettifyPath(unprettified);
42 EXPECT_NE(unprettified, prettified);
43 EXPECT_EQ(
44 FilePath(kHomeShortcut).AppendASCII("foo").AppendASCII("bar"),
45 prettified);
48 } // namespace extensions