Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: content/public/test/browser_test_utils.cc

Issue 2523583003: Fix some flaky tests. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 } 1309 }
1310 1310
1311 void DOMMessageQueue::ClearQueue() { 1311 void DOMMessageQueue::ClearQueue() {
1312 message_queue_ = std::queue<std::string>(); 1312 message_queue_ = std::queue<std::string>();
1313 } 1313 }
1314 1314
1315 bool DOMMessageQueue::WaitForMessage(std::string* message) { 1315 bool DOMMessageQueue::WaitForMessage(std::string* message) {
1316 DCHECK(message); 1316 DCHECK(message);
1317 if (message_queue_.empty()) { 1317 if (message_queue_.empty()) {
1318 // This will be quit when a new message comes in. 1318 // This will be quit when a new message comes in.
1319 message_loop_runner_ = new MessageLoopRunner; 1319 message_loop_runner_ =
1320 new MessageLoopRunner(MessageLoopRunner::QuitMode::IMMEDIATE);
1320 message_loop_runner_->Run(); 1321 message_loop_runner_->Run();
1321 } 1322 }
1322 // The queue should not be empty, unless we were quit because of a timeout. 1323 // The queue should not be empty, unless we were quit because of a timeout.
1323 if (message_queue_.empty()) 1324 if (message_queue_.empty())
1324 return false; 1325 return false;
1325 *message = message_queue_.front(); 1326 *message = message_queue_.front();
1326 message_queue_.pop(); 1327 message_queue_.pop();
1327 return true; 1328 return true;
1328 } 1329 }
1329 1330
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 1768
1768 std::string ascii_message = base::UTF16ToASCII(message); 1769 std::string ascii_message = base::UTF16ToASCII(message);
1769 if (base::MatchPattern(ascii_message, filter_)) { 1770 if (base::MatchPattern(ascii_message, filter_)) {
1770 message_ = ascii_message; 1771 message_ = ascii_message;
1771 message_loop_runner_->Quit(); 1772 message_loop_runner_->Quit();
1772 } 1773 }
1773 return false; 1774 return false;
1774 } 1775 }
1775 1776
1776 } // namespace content 1777 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698