| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "tools/gn/filesystem_utils.h" | 10 #include "tools/gn/filesystem_utils.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 base::FilePath("/source/foo/bar/")).value()); | 409 base::FilePath("/source/foo/bar/")).value()); |
| 410 EXPECT_EQ("//bar/baz/", SourceDirForPath(root, | 410 EXPECT_EQ("//bar/baz/", SourceDirForPath(root, |
| 411 base::FilePath("/source/foo/bar/baz/")).value()); | 411 base::FilePath("/source/foo/bar/baz/")).value()); |
| 412 | 412 |
| 413 // Should be case-sensitive. | 413 // Should be case-sensitive. |
| 414 EXPECT_EQ("/SOURCE/foo/bar/", SourceDirForPath(root, | 414 EXPECT_EQ("/SOURCE/foo/bar/", SourceDirForPath(root, |
| 415 base::FilePath("/SOURCE/foo/bar/")).value()); | 415 base::FilePath("/SOURCE/foo/bar/")).value()); |
| 416 | 416 |
| 417 // Empty source dir. | 417 // Empty source dir. |
| 418 base::FilePath empty; | 418 base::FilePath empty; |
| 419 EXPECT_EQ("/source/foo", | 419 EXPECT_EQ("/source/foo/", |
| 420 SourceDirForPath(empty, base::FilePath("/source/foo")).value()); | 420 SourceDirForPath(empty, base::FilePath("/source/foo")).value()); |
| 421 #endif | 421 #endif |
| 422 } | 422 } |
| 423 | 423 |
| 424 TEST(FilesystemUtils, GetToolchainDirs) { | 424 TEST(FilesystemUtils, GetToolchainDirs) { |
| 425 BuildSettings build_settings; | 425 BuildSettings build_settings; |
| 426 build_settings.SetBuildDir(SourceDir("//out/Debug/")); | 426 build_settings.SetBuildDir(SourceDir("//out/Debug/")); |
| 427 | 427 |
| 428 // The default toolchain. | 428 // The default toolchain. |
| 429 Settings default_settings(&build_settings, ""); | 429 Settings default_settings(&build_settings, ""); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value()); | 567 EXPECT_EQ("gen/", GetToolchainGenDirAsOutputFile(&settings).value()); |
| 568 EXPECT_EQ("//obj/", | 568 EXPECT_EQ("//obj/", |
| 569 GetOutputDirForSourceDir(&settings, SourceDir("//")).value()); | 569 GetOutputDirForSourceDir(&settings, SourceDir("//")).value()); |
| 570 EXPECT_EQ("obj/", | 570 EXPECT_EQ("obj/", |
| 571 GetOutputDirForSourceDirAsOutputFile( | 571 GetOutputDirForSourceDirAsOutputFile( |
| 572 &settings, SourceDir("//")).value()); | 572 &settings, SourceDir("//")).value()); |
| 573 EXPECT_EQ("gen/", | 573 EXPECT_EQ("gen/", |
| 574 GetGenDirForSourceDirAsOutputFile( | 574 GetGenDirForSourceDirAsOutputFile( |
| 575 &settings, SourceDir("//")).value()); | 575 &settings, SourceDir("//")).value()); |
| 576 } | 576 } |
| OLD | NEW |