| 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 <map> | 5 #include <map> |
| 6 #include <utility> | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 scoped_ptr<CannedResult> canned(new CannedResult); | 71 scoped_ptr<CannedResult> canned(new CannedResult); |
| 72 canned->input_file.reset(new InputFile(source_file)); | 72 canned->input_file.reset(new InputFile(source_file)); |
| 73 canned->input_file->SetContents(source); | 73 canned->input_file->SetContents(source); |
| 74 | 74 |
| 75 // Tokenize. | 75 // Tokenize. |
| 76 Err err; | 76 Err err; |
| 77 canned->tokens = Tokenizer::Tokenize(canned->input_file.get(), &err); | 77 canned->tokens = Tokenizer::Tokenize(canned->input_file.get(), &err); |
| 78 EXPECT_FALSE(err.has_error()); | 78 EXPECT_FALSE(err.has_error()); |
| 79 | 79 |
| 80 // Parse. | 80 // Parse. |
| 81 canned->root = Parser::Parse(canned->tokens, &err).Pass(); | 81 canned->root = Parser::Parse(canned->tokens, &err); |
| 82 EXPECT_FALSE(err.has_error()); | 82 EXPECT_FALSE(err.has_error()); |
| 83 | 83 |
| 84 canned_responses_[source_file] = std::move(canned); | 84 canned_responses_[source_file] = std::move(canned); |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool MockInputFileManager::HasOnePending(const SourceFile& f) const { | 87 bool MockInputFileManager::HasOnePending(const SourceFile& f) const { |
| 88 return pending_.size() == 1u && pending_[0].first == f; | 88 return pending_.size() == 1u && pending_[0].first == f; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool MockInputFileManager::HasTwoPending(const SourceFile& f1, | 91 bool MockInputFileManager::HasTwoPending(const SourceFile& f1, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 loader->Load(third_file, LocationRange(), second_tc); | 177 loader->Load(third_file, LocationRange(), second_tc); |
| 178 EXPECT_TRUE(mock_ifm_.HasOnePending(build_config)); | 178 EXPECT_TRUE(mock_ifm_.HasOnePending(build_config)); |
| 179 | 179 |
| 180 // Running the build config file should make our third file pending. | 180 // Running the build config file should make our third file pending. |
| 181 mock_ifm_.IssueAllPending(); | 181 mock_ifm_.IssueAllPending(); |
| 182 scheduler_.main_loop()->RunUntilIdle(); | 182 scheduler_.main_loop()->RunUntilIdle(); |
| 183 EXPECT_TRUE(mock_ifm_.HasTwoPending(second_file, third_file)); | 183 EXPECT_TRUE(mock_ifm_.HasTwoPending(second_file, third_file)); |
| 184 | 184 |
| 185 EXPECT_FALSE(scheduler_.is_failed()); | 185 EXPECT_FALSE(scheduler_.is_failed()); |
| 186 } | 186 } |
| OLD | NEW |