| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "tools/gn/builder.h" | 6 #include "tools/gn/builder.h" |
| 7 #include "tools/gn/loader.h" | 7 #include "tools/gn/loader.h" |
| 8 #include "tools/gn/target.h" | 8 #include "tools/gn/target.h" |
| 9 #include "tools/gn/test_with_scope.h" | 9 #include "tools/gn/test_with_scope.h" |
| 10 #include "tools/gn/toolchain.h" | 10 #include "tools/gn/toolchain.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 EXPECT_TRUE(a_record->unresolved_deps().empty()); | 168 EXPECT_TRUE(a_record->unresolved_deps().empty()); |
| 169 EXPECT_TRUE(b_record->unresolved_deps().empty()); | 169 EXPECT_TRUE(b_record->unresolved_deps().empty()); |
| 170 EXPECT_TRUE(c_record->unresolved_deps().empty()); | 170 EXPECT_TRUE(c_record->unresolved_deps().empty()); |
| 171 | 171 |
| 172 EXPECT_TRUE(a_record->waiting_on_resolution().empty()); | 172 EXPECT_TRUE(a_record->waiting_on_resolution().empty()); |
| 173 EXPECT_TRUE(b_record->waiting_on_resolution().empty()); | 173 EXPECT_TRUE(b_record->waiting_on_resolution().empty()); |
| 174 EXPECT_TRUE(c_record->waiting_on_resolution().empty()); | 174 EXPECT_TRUE(c_record->waiting_on_resolution().empty()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Tests that the should generate bit is set and propogated properly. | 177 // Tests that the "should generate" flag is set and propagated properly. |
| 178 TEST_F(BuilderTest, ShouldGenerate) { | 178 TEST_F(BuilderTest, ShouldGenerate) { |
| 179 DefineToolchain(); | 179 DefineToolchain(); |
| 180 | 180 |
| 181 // Define a secondary toolchain. | 181 // Define a secondary toolchain. |
| 182 Settings settings2(&build_settings_, "secondary/"); | 182 Settings settings2(&build_settings_, "secondary/"); |
| 183 Label toolchain_label2(SourceDir("//tc/"), "secondary"); | 183 Label toolchain_label2(SourceDir("//tc/"), "secondary"); |
| 184 settings2.set_toolchain_label(toolchain_label2); | 184 settings2.set_toolchain_label(toolchain_label2); |
| 185 Toolchain* tc2 = new Toolchain(&settings2, toolchain_label2); | 185 Toolchain* tc2 = new Toolchain(&settings2, toolchain_label2); |
| 186 TestWithScope::SetupToolchain(tc2); | 186 TestWithScope::SetupToolchain(tc2); |
| 187 builder_->ItemDefined(scoped_ptr<Item>(tc2)); | 187 builder_->ItemDefined(scoped_ptr<Item>(tc2)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 209 a->set_output_type(Target::EXECUTABLE); | 209 a->set_output_type(Target::EXECUTABLE); |
| 210 builder_->ItemDefined(scoped_ptr<Item>(a)); | 210 builder_->ItemDefined(scoped_ptr<Item>(a)); |
| 211 | 211 |
| 212 // A should have the generate bit set since it's in the default toolchain. | 212 // A should have the generate bit set since it's in the default toolchain. |
| 213 BuilderRecord* a_record = builder_->GetRecord(a_label); | 213 BuilderRecord* a_record = builder_->GetRecord(a_label); |
| 214 EXPECT_TRUE(a_record->should_generate()); | 214 EXPECT_TRUE(a_record->should_generate()); |
| 215 | 215 |
| 216 // It should have gotten pushed to B. | 216 // It should have gotten pushed to B. |
| 217 EXPECT_TRUE(b_record->should_generate()); | 217 EXPECT_TRUE(b_record->should_generate()); |
| 218 } | 218 } |
| OLD | NEW |