Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / chromeos / file_manager / path_util_unittest.cc
blob0e0084193cb3ddce8890f46e911a7350e5a70181
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 "content/public/test/test_browser_thread_bundle.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace file_manager {
14 namespace util {
15 namespace {
17 TEST(FileManagerPathUtilTest, MultiProfileDownloadsFolderMigration) {
18 content::TestBrowserThreadBundle thread_bundle;
19 TestingProfile profile;
21 // This looks like "/home/chronos/u-hash/Downloads" in the production
22 // environment.
23 const base::FilePath kDownloads = GetDownloadsFolderForProfile(&profile);
24 const base::FilePath kOldDownloads =
25 DownloadPrefs::GetDefaultDownloadDirectory();
27 base::FilePath path;
29 EXPECT_TRUE(MigratePathFromOldFormat(&profile, kOldDownloads, &path));
30 EXPECT_EQ(kDownloads, path);
32 EXPECT_TRUE(MigratePathFromOldFormat(
33 &profile,
34 kOldDownloads.AppendASCII("a/b"),
35 &path));
36 EXPECT_EQ(kDownloads.AppendASCII("a/b"), path);
38 // Path already in the new format is not converted.
39 EXPECT_FALSE(MigratePathFromOldFormat(
40 &profile,
41 kDownloads.AppendASCII("a/b"),
42 &path));
44 // Only the "Downloads" path is converted.
45 EXPECT_FALSE(MigratePathFromOldFormat(
46 &profile,
47 base::FilePath::FromUTF8Unsafe("/home/chronos/user/dl"),
48 &path));
51 } // namespace
52 } // namespace util
53 } // namespace file_manager