| Index: tools/gn/function_rebase_path_unittest.cc
|
| diff --git a/tools/gn/function_rebase_path_unittest.cc b/tools/gn/function_rebase_path_unittest.cc
|
| index 0537d10d50aa296144c8ebf721b861e32ef906dc..20b492e99b2031bb919b933a437854c7aa40e3f0 100644
|
| --- a/tools/gn/function_rebase_path_unittest.cc
|
| +++ b/tools/gn/function_rebase_path_unittest.cc
|
| @@ -78,6 +78,59 @@ TEST(RebasePath, Strings) {
|
| #endif
|
| }
|
|
|
| +TEST(RebasePath, StringsSystemPaths) {
|
| + TestWithScope setup;
|
| + Scope* scope = setup.scope();
|
| +
|
| +#if defined(OS_WIN)
|
| + setup.build_settings()->SetBuildDir(SourceDir("C:/ssd/out/Debug"));
|
| + setup.build_settings()->SetRootPath(base::FilePath(L"C:/hdd/src"));
|
| +
|
| + // Test system absolute to-dir.
|
| + EXPECT_EQ("../../ssd/out/Debug",
|
| + RebaseOne(scope, ".", "//", "C:/ssd/out/Debug"));
|
| + EXPECT_EQ("../../ssd/out/Debug/",
|
| + RebaseOne(scope, "./", "//", "C:/ssd/out/Debug"));
|
| + EXPECT_EQ("../../ssd/out/Debug/foo",
|
| + RebaseOne(scope, "foo", "//", "C:/ssd/out/Debug"));
|
| + EXPECT_EQ("../../ssd/out/Debug/foo/",
|
| + RebaseOne(scope, "foo/", "//", "C:/ssd/out/Debug"));
|
| +
|
| + // Test system absolute from-dir.
|
| + EXPECT_EQ("../../../hdd/src",
|
| + RebaseOne(scope, ".", "C:/ssd/out/Debug", "//"));
|
| + EXPECT_EQ("../../../hdd/src/",
|
| + RebaseOne(scope, "./", "C:/ssd/out/Debug", "//"));
|
| + EXPECT_EQ("../../../hdd/src/foo",
|
| + RebaseOne(scope, "foo", "C:/ssd/out/Debug", "//"));
|
| + EXPECT_EQ("../../../hdd/src/foo/",
|
| + RebaseOne(scope, "foo/", "C:/ssd/out/Debug", "//"));
|
| +#else
|
| + setup.build_settings()->SetBuildDir(SourceDir("/ssd/out/Debug"));
|
| + setup.build_settings()->SetRootPath(base::FilePath("/hdd/src"));
|
| +
|
| + // Test system absolute to-dir.
|
| + EXPECT_EQ("../../ssd/out/Debug",
|
| + RebaseOne(scope, ".", "//", "/ssd/out/Debug"));
|
| + EXPECT_EQ("../../ssd/out/Debug/",
|
| + RebaseOne(scope, "./", "//", "/ssd/out/Debug"));
|
| + EXPECT_EQ("../../ssd/out/Debug/foo",
|
| + RebaseOne(scope, "foo", "//", "/ssd/out/Debug"));
|
| + EXPECT_EQ("../../ssd/out/Debug/foo/",
|
| + RebaseOne(scope, "foo/", "//", "/ssd/out/Debug"));
|
| +
|
| + // Test system absolute from-dir.
|
| + EXPECT_EQ("../../../hdd/src",
|
| + RebaseOne(scope, ".", "/ssd/out/Debug", "//"));
|
| + EXPECT_EQ("../../../hdd/src/",
|
| + RebaseOne(scope, "./", "/ssd/out/Debug", "//"));
|
| + EXPECT_EQ("../../../hdd/src/foo",
|
| + RebaseOne(scope, "foo", "/ssd/out/Debug", "//"));
|
| + EXPECT_EQ("../../../hdd/src/foo/",
|
| + RebaseOne(scope, "foo/", "/ssd/out/Debug", "//"));
|
| +#endif
|
| +}
|
| +
|
| // Test list input.
|
| TEST(RebasePath, List) {
|
| TestWithScope setup;
|
|
|