| 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/fileapi/file_system_backend.h" | 5 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // System mount points path more specific. | 251 // System mount points path more specific. |
| 252 { FPL("/m/n/o/p/r/s"), true, FPL("n/o/p/r/s") }, | 252 { FPL("/m/n/o/p/r/s"), true, FPL("n/o/p/r/s") }, |
| 253 // System mount points path less specific. | 253 // System mount points path less specific. |
| 254 { FPL("/z/y/x"), true, FPL("y/x") }, | 254 { FPL("/z/y/x"), true, FPL("y/x") }, |
| 255 // Only system mount points path matches. | 255 // Only system mount points path matches. |
| 256 { FPL("/z/q/r/s"), true, FPL("gz/q/r/s") }, | 256 { FPL("/z/q/r/s"), true, FPL("gz/q/r/s") }, |
| 257 // No match. | 257 // No match. |
| 258 { FPL("/foo/xxx"), false, FPL("") }, | 258 { FPL("/foo/xxx"), false, FPL("") }, |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { | 261 for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
| 262 // Initialize virtual path with a value. | 262 // Initialize virtual path with a value. |
| 263 base::FilePath virtual_path(FPL("/mount")); | 263 base::FilePath virtual_path(FPL("/mount")); |
| 264 base::FilePath local_path(kTestCases[i].local_path); | 264 base::FilePath local_path(kTestCases[i].local_path); |
| 265 EXPECT_EQ(kTestCases[i].success, | 265 EXPECT_EQ(kTestCases[i].success, |
| 266 backend.GetVirtualPath(local_path, &virtual_path)) | 266 backend.GetVirtualPath(local_path, &virtual_path)) |
| 267 << "Resolving " << kTestCases[i].local_path; | 267 << "Resolving " << kTestCases[i].local_path; |
| 268 | 268 |
| 269 // There are no guarantees for |virtual_path| value if |GetVirtualPath| | 269 // There are no guarantees for |virtual_path| value if |GetVirtualPath| |
| 270 // fails. | 270 // fails. |
| 271 if (!kTestCases[i].success) | 271 if (!kTestCases[i].success) |
| 272 continue; | 272 continue; |
| 273 | 273 |
| 274 base::FilePath expected_virtual_path(kTestCases[i].virtual_path); | 274 base::FilePath expected_virtual_path(kTestCases[i].virtual_path); |
| 275 EXPECT_EQ(expected_virtual_path, virtual_path) | 275 EXPECT_EQ(expected_virtual_path, virtual_path) |
| 276 << "Resolving " << kTestCases[i].local_path; | 276 << "Resolving " << kTestCases[i].local_path; |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace | 280 } // namespace |
| OLD | NEW |