Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / file_manager / path_util_unittest.cc
blob5c3d3bda443f9c1e5d7cc63198a6ebc418fea0c9
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 "chrome/browser/chromeos/file_manager/path_util.h"
7 #include "base/files/file_path.h"
8 #include "chrome/browser/download/download_prefs.h"
9 #include "chrome/test/base/testing_profile.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace file_manager {
13 namespace util {
14 namespace {
16 TEST(FileManagerPathUtilTest, MultiProfileDownloadsFolderMigration) {
17 TestingProfile profile;
19 // This looks like "/home/chronos/u-hash/Downloads" in the production
20 // environment.
21 const base::FilePath kDownloads = GetDownloadsFolderForProfile(&profile);
22 const base::FilePath kOldDownloads =
23 DownloadPrefs::GetDefaultDownloadDirectory();
25 base::FilePath path;
27 EXPECT_TRUE(MigratePathFromOldFormat(&profile, kOldDownloads, &path));
28 EXPECT_EQ(kDownloads, path);
30 EXPECT_TRUE(MigratePathFromOldFormat(
31 &profile,
32 kOldDownloads.AppendASCII("a/b"),
33 &path));
34 EXPECT_EQ(kDownloads.AppendASCII("a/b"), path);
36 // Path already in the new format is not converted.
37 EXPECT_FALSE(MigratePathFromOldFormat(
38 &profile,
39 kDownloads.AppendASCII("a/b"),
40 &path));
42 // Only the "Downloads" path is converted.
43 EXPECT_FALSE(MigratePathFromOldFormat(
44 &profile,
45 base::FilePath::FromUTF8Unsafe("/home/chronos/user/dl"),
46 &path));
49 } // namespace
50 } // namespace util
51 } // namespace file_manager