| 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/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool MockInputFileManager::HasTwoPending(const SourceFile& f1, | 91 bool MockInputFileManager::HasTwoPending(const SourceFile& f1, |
| 92 const SourceFile& f2) const { | 92 const SourceFile& f2) const { |
| 93 if (pending_.size() != 2u) | 93 if (pending_.size() != 2u) |
| 94 return false; | 94 return false; |
| 95 return pending_[0].first == f1 && pending_[1].first == f2; | 95 return pending_[0].first == f1 && pending_[1].first == f2; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void MockInputFileManager::IssueAllPending() { | 98 void MockInputFileManager::IssueAllPending() { |
| 99 BlockNode block; // Default response. | 99 BlockNode block(BlockNode::DISCARDS_RESULT); // Default response. |
| 100 | 100 |
| 101 for (const auto& cur : pending_) { | 101 for (const auto& cur : pending_) { |
| 102 CannedResponseMap::const_iterator found = canned_responses_.find(cur.first); | 102 CannedResponseMap::const_iterator found = canned_responses_.find(cur.first); |
| 103 if (found == canned_responses_.end()) | 103 if (found == canned_responses_.end()) |
| 104 cur.second.Run(&block); | 104 cur.second.Run(&block); |
| 105 else | 105 else |
| 106 cur.second.Run(found->second->root.get()); | 106 cur.second.Run(found->second->root.get()); |
| 107 } | 107 } |
| 108 pending_.clear(); | 108 pending_.clear(); |
| 109 } | 109 } |
| (...skipping 67 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 base::RunLoop().RunUntilIdle(); | 182 base::RunLoop().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 |