| 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" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 class MockLoader : public Loader { | 14 class MockLoader : public Loader { |
| 15 public: | 15 public: |
| 16 MockLoader() { | 16 MockLoader() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 // Loader implementation: | 19 // Loader implementation: |
| 20 virtual void Load(const SourceFile& file, | 20 virtual void Load(const SourceFile& file, |
| 21 const LocationRange& origin, | 21 const LocationRange& origin, |
| 22 const Label& toolchain_name) OVERRIDE { | 22 const Label& toolchain_name) override { |
| 23 files_.push_back(file); | 23 files_.push_back(file); |
| 24 } | 24 } |
| 25 virtual void ToolchainLoaded(const Toolchain* toolchain) OVERRIDE { | 25 virtual void ToolchainLoaded(const Toolchain* toolchain) override { |
| 26 } | 26 } |
| 27 virtual Label GetDefaultToolchain() const OVERRIDE { | 27 virtual Label GetDefaultToolchain() const override { |
| 28 return Label(); | 28 return Label(); |
| 29 } | 29 } |
| 30 virtual const Settings* GetToolchainSettings( | 30 virtual const Settings* GetToolchainSettings( |
| 31 const Label& label) const OVERRIDE { | 31 const Label& label) const override { |
| 32 return NULL; | 32 return NULL; |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool HasLoadedNone() const { | 35 bool HasLoadedNone() const { |
| 36 return files_.empty(); | 36 return files_.empty(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // Returns true if two loads have been requested and they match the given | 39 // Returns true if two loads have been requested and they match the given |
| 40 // file. This will clear the records so it will be empty for the next call. | 40 // file. This will clear the records so it will be empty for the next call. |
| 41 bool HasLoadedTwo(const SourceFile& a, const SourceFile& b) { | 41 bool HasLoadedTwo(const SourceFile& a, const SourceFile& b) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 a->set_output_type(Target::EXECUTABLE); | 213 a->set_output_type(Target::EXECUTABLE); |
| 214 builder_->ItemDefined(scoped_ptr<Item>(a)); | 214 builder_->ItemDefined(scoped_ptr<Item>(a)); |
| 215 | 215 |
| 216 // A should have the generate bit set since it's in the default toolchain. | 216 // A should have the generate bit set since it's in the default toolchain. |
| 217 BuilderRecord* a_record = builder_->GetRecord(a_label); | 217 BuilderRecord* a_record = builder_->GetRecord(a_label); |
| 218 EXPECT_TRUE(a_record->should_generate()); | 218 EXPECT_TRUE(a_record->should_generate()); |
| 219 | 219 |
| 220 // It should have gotten pushed to B. | 220 // It should have gotten pushed to B. |
| 221 EXPECT_TRUE(b_record->should_generate()); | 221 EXPECT_TRUE(b_record->should_generate()); |
| 222 } | 222 } |
| OLD | NEW |