OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 bool WaitFor(Profile* profile, | 186 bool WaitFor(Profile* profile, |
187 const std::string& event_name, | 187 const std::string& event_name, |
188 const std::string& json_args) { | 188 const std::string& json_args) { |
189 waiting_for_.reset(new Event(profile, event_name, json_args, base::Time())); | 189 waiting_for_.reset(new Event(profile, event_name, json_args, base::Time())); |
190 for (std::deque<Event*>::const_iterator iter = events_.begin(); | 190 for (std::deque<Event*>::const_iterator iter = events_.begin(); |
191 iter != events_.end(); ++iter) { | 191 iter != events_.end(); ++iter) { |
192 if ((*iter)->Equals(*waiting_for_.get())) | 192 if ((*iter)->Equals(*waiting_for_.get())) |
193 return true; | 193 return true; |
194 } | 194 } |
195 waiting_ = true; | 195 waiting_ = true; |
196 ui_test_utils::RunMessageLoop(); | 196 content::RunMessageLoop(); |
197 bool success = !waiting_; | 197 bool success = !waiting_; |
198 if (waiting_) { | 198 if (waiting_) { |
199 // Print the events that were caught since the last WaitFor() call to help | 199 // Print the events that were caught since the last WaitFor() call to help |
200 // find the erroneous event. | 200 // find the erroneous event. |
201 // TODO(benjhayden) Fuzzy-match and highlight the erroneous event. | 201 // TODO(benjhayden) Fuzzy-match and highlight the erroneous event. |
202 for (std::deque<Event*>::const_iterator iter = events_.begin(); | 202 for (std::deque<Event*>::const_iterator iter = events_.begin(); |
203 iter != events_.end(); ++iter) { | 203 iter != events_.end(); ++iter) { |
204 if ((*iter)->caught() > last_wait_) { | 204 if ((*iter)->caught() > last_wait_) { |
205 LOG(INFO) << "Caught " << (*iter)->Debug(); | 205 LOG(INFO) << "Caught " << (*iter)->Debug(); |
206 } | 206 } |
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 " \"state\": {" | 2179 " \"state\": {" |
2180 " \"previous\": \"in_progress\"," | 2180 " \"previous\": \"in_progress\"," |
2181 " \"current\": \"complete\"}}]", | 2181 " \"current\": \"complete\"}}]", |
2182 result_id, | 2182 result_id, |
2183 GetFilename("on_record.txt.crdownload").c_str(), | 2183 GetFilename("on_record.txt.crdownload").c_str(), |
2184 GetFilename("on_record.txt").c_str()))); | 2184 GetFilename("on_record.txt").c_str()))); |
2185 std::string disk_data; | 2185 std::string disk_data; |
2186 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); | 2186 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); |
2187 EXPECT_STREQ(kPayloadData, disk_data.c_str()); | 2187 EXPECT_STREQ(kPayloadData, disk_data.c_str()); |
2188 } | 2188 } |
OLD | NEW |