Index: tools/gn/filesystem_utils_unittest.cc |
diff --git a/tools/gn/filesystem_utils_unittest.cc b/tools/gn/filesystem_utils_unittest.cc |
index d5638900e2e204802df6acb9cac974cc87194fb6..894b3da7d2393cc2549bd6ef020e34c7fa23a31d 100644 |
--- a/tools/gn/filesystem_utils_unittest.cc |
+++ b/tools/gn/filesystem_utils_unittest.cc |
@@ -488,6 +488,24 @@ TEST(FilesystemUtils, RebasePath) { |
RebasePath("/path/to/foo", SourceDir("/source/root/a/b"), |
base::StringPiece("/x/y/z"))); |
+#if defined(OS_WIN) |
+ // Test corrections while rebasing Windows-style absolute paths. |
+ EXPECT_EQ("../../../../path/to/foo", |
+ RebasePath("C:/path/to/foo", SourceDir("//a/b"), |
+ base::StringPiece("/C:/source/root"))); |
+ EXPECT_EQ("../../../../path/to/foo", |
+ RebasePath("/C:/path/to/foo", SourceDir("//a/b"), |
+ base::StringPiece("C:/source/root"))); |
+ EXPECT_EQ("../../../../path/to/foo", |
+ RebasePath("/C:/path/to/foo", SourceDir("//a/b"), |
+ base::StringPiece("/c:/source/root"))); |
+ EXPECT_EQ("../../../../path/to/foo", |
+ RebasePath("/c:/path/to/foo", SourceDir("//a/b"), |
+ base::StringPiece("c:/source/root"))); |
+ EXPECT_EQ("../../../../path/to/foo", |
+ RebasePath("/c:/path/to/foo", SourceDir("//a/b"), |
+ base::StringPiece("C:/source/root"))); |
+#endif |
} |
TEST(FilesystemUtils, DirectoryWithNoLastSlash) { |