OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/file_manager/path_util.h" | 5 #include "chrome/browser/chromeos/file_manager/path_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 8 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
9 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 9 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 EXPECT_TRUE(ConvertPathToArcUrl( | 83 EXPECT_TRUE(ConvertPathToArcUrl( |
84 base::FilePath::FromUTF8Unsafe("/media/removable/a/b/c"), &url)); | 84 base::FilePath::FromUTF8Unsafe("/media/removable/a/b/c"), &url)); |
85 EXPECT_EQ(GURL("content://org.chromium.arc.removablemediaprovider/a/b/c"), | 85 EXPECT_EQ(GURL("content://org.chromium.arc.removablemediaprovider/a/b/c"), |
86 url); | 86 url); |
87 | 87 |
88 EXPECT_FALSE(ConvertPathToArcUrl( | 88 EXPECT_FALSE(ConvertPathToArcUrl( |
89 base::FilePath::FromUTF8Unsafe("/media/removable_foobar"), &url)); | 89 base::FilePath::FromUTF8Unsafe("/media/removable_foobar"), &url)); |
90 | 90 |
91 // Conversion of paths under the primary profile's downloads folder. | 91 // Conversion of paths under the primary profile's downloads folder. |
92 const base::FilePath downloads = GetDownloadsFolderForProfile( | 92 const base::FilePath downloads = GetDownloadsFolderForProfile( |
93 chromeos::ProfileHelper::Get()->GetProfileByUserIdHash( | 93 chromeos::ProfileHelper::Get()->GetProfileByUserIdHashForTest( |
94 "user@gmail.com-hash")); | 94 "user@gmail.com-hash")); |
95 EXPECT_TRUE(ConvertPathToArcUrl(downloads.AppendASCII("a/b/c"), &url)); | 95 EXPECT_TRUE(ConvertPathToArcUrl(downloads.AppendASCII("a/b/c"), &url)); |
96 EXPECT_EQ(GURL("file:///sdcard/Download/a/b/c"), url); | 96 EXPECT_EQ(GURL("file:///sdcard/Download/a/b/c"), url); |
97 | 97 |
98 // Non-primary profile's downloads folder is not supported for ARC yet. | 98 // Non-primary profile's downloads folder is not supported for ARC yet. |
99 const base::FilePath downloads2 = GetDownloadsFolderForProfile( | 99 const base::FilePath downloads2 = GetDownloadsFolderForProfile( |
100 chromeos::ProfileHelper::Get()->GetProfileByUserIdHash( | 100 chromeos::ProfileHelper::Get()->GetProfileByUserIdHashForTest( |
101 "user2@gmail.com-hash")); | 101 "user2@gmail.com-hash")); |
102 EXPECT_FALSE(ConvertPathToArcUrl(downloads2.AppendASCII("a/b/c"), &url)); | 102 EXPECT_FALSE(ConvertPathToArcUrl(downloads2.AppendASCII("a/b/c"), &url)); |
103 } | 103 } |
104 | 104 |
105 } // namespace | 105 } // namespace |
106 } // namespace util | 106 } // namespace util |
107 } // namespace file_manager | 107 } // namespace file_manager |
OLD | NEW |