| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "tools/gn/visual_studio_writer.h" | 5 #include "tools/gn/visual_studio_writer.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "tools/gn/test_with_scope.h" | 9 #include "tools/gn/test_with_scope.h" |
| 9 #include "tools/gn/visual_studio_utils.h" | 10 #include "tools/gn/visual_studio_utils.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 class VisualStudioWriterTest : public testing::Test { | 14 class VisualStudioWriterTest : public testing::Test { |
| 14 protected: | 15 protected: |
| 15 TestWithScope setup_; | 16 TestWithScope setup_; |
| 16 }; | 17 }; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 writer.projects_.emplace_back(new VisualStudioWriter::SolutionProject( | 94 writer.projects_.emplace_back(new VisualStudioWriter::SolutionProject( |
| 94 "gn", path, MakeGuid(path, "project"), | 95 "gn", path, MakeGuid(path, "project"), |
| 95 MakeTestPath("/foo/chromium/src/tools/gn"), "Win32")); | 96 MakeTestPath("/foo/chromium/src/tools/gn"), "Win32")); |
| 96 | 97 |
| 97 path = MakeTestPath( | 98 path = MakeTestPath( |
| 98 "/foo/chromium/src/out/Debug/obj/ABS_PATH/C/foo/bar/bar.vcxproj"); | 99 "/foo/chromium/src/out/Debug/obj/ABS_PATH/C/foo/bar/bar.vcxproj"); |
| 99 writer.projects_.emplace_back(new VisualStudioWriter::SolutionProject( | 100 writer.projects_.emplace_back(new VisualStudioWriter::SolutionProject( |
| 100 "bar", path, MakeGuid(path, "project"), MakeTestPath("/foo/bar"), | 101 "bar", path, MakeGuid(path, "project"), MakeTestPath("/foo/bar"), |
| 101 "Win32")); | 102 "Win32")); |
| 102 | 103 |
| 104 std::string baz_label_dir_path = MakeTestPath("/foo/bar/baz"); |
| 105 #if defined(OS_WIN) |
| 106 // Make sure mixed lower and upper-case drive letters are handled properly. |
| 107 baz_label_dir_path[0] = base::ToLowerASCII(baz_label_dir_path[0]); |
| 108 #endif |
| 103 path = MakeTestPath( | 109 path = MakeTestPath( |
| 104 "/foo/chromium/src/out/Debug/obj/ABS_PATH/C/foo/bar/baz/baz.vcxproj"); | 110 "/foo/chromium/src/out/Debug/obj/ABS_PATH/C/foo/bar/baz/baz.vcxproj"); |
| 105 writer.projects_.emplace_back(new VisualStudioWriter::SolutionProject( | 111 writer.projects_.emplace_back(new VisualStudioWriter::SolutionProject( |
| 106 "baz", path, MakeGuid(path, "project"), MakeTestPath("/foo/bar/baz"), | 112 "baz", path, MakeGuid(path, "project"), baz_label_dir_path, "Win32")); |
| 107 "Win32")); | |
| 108 | 113 |
| 109 writer.ResolveSolutionFolders(); | 114 writer.ResolveSolutionFolders(); |
| 110 | 115 |
| 111 ASSERT_EQ(MakeTestPath("/foo"), writer.root_folder_path_); | 116 ASSERT_EQ(MakeTestPath("/foo"), writer.root_folder_path_); |
| 112 | 117 |
| 113 ASSERT_EQ(7u, writer.folders_.size()); | 118 ASSERT_EQ(7u, writer.folders_.size()); |
| 114 | 119 |
| 115 ASSERT_EQ("bar", writer.folders_[0]->name); | 120 ASSERT_EQ("bar", writer.folders_[0]->name); |
| 116 ASSERT_EQ(MakeTestPath("/foo/bar"), writer.folders_[0]->path); | 121 ASSERT_EQ(MakeTestPath("/foo/bar"), writer.folders_[0]->path); |
| 117 ASSERT_EQ(nullptr, writer.folders_[0]->parent_folder); | 122 ASSERT_EQ(nullptr, writer.folders_[0]->parent_folder); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 139 ASSERT_EQ("gn", writer.folders_[6]->name); | 144 ASSERT_EQ("gn", writer.folders_[6]->name); |
| 140 ASSERT_EQ(MakeTestPath("/foo/chromium/src/tools/gn"), | 145 ASSERT_EQ(MakeTestPath("/foo/chromium/src/tools/gn"), |
| 141 writer.folders_[6]->path); | 146 writer.folders_[6]->path); |
| 142 ASSERT_EQ(writer.folders_[5].get(), writer.folders_[6]->parent_folder); | 147 ASSERT_EQ(writer.folders_[5].get(), writer.folders_[6]->parent_folder); |
| 143 | 148 |
| 144 ASSERT_EQ(writer.folders_[4].get(), writer.projects_[0]->parent_folder); | 149 ASSERT_EQ(writer.folders_[4].get(), writer.projects_[0]->parent_folder); |
| 145 ASSERT_EQ(writer.folders_[6].get(), writer.projects_[1]->parent_folder); | 150 ASSERT_EQ(writer.folders_[6].get(), writer.projects_[1]->parent_folder); |
| 146 ASSERT_EQ(writer.folders_[0].get(), writer.projects_[2]->parent_folder); | 151 ASSERT_EQ(writer.folders_[0].get(), writer.projects_[2]->parent_folder); |
| 147 ASSERT_EQ(writer.folders_[1].get(), writer.projects_[3]->parent_folder); | 152 ASSERT_EQ(writer.folders_[1].get(), writer.projects_[3]->parent_folder); |
| 148 } | 153 } |
| OLD | NEW |