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

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

Issue 2540683002: Don't defer quitting in ExecuteScript and other helpers that use DOMMessageQueue. (Closed)
Patch Set: rebase 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
« no previous file with comments | « chromeos/cryptohome/mock_homedir_methods.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 } 1316 }
1317 1317
1318 void DOMMessageQueue::ClearQueue() { 1318 void DOMMessageQueue::ClearQueue() {
1319 message_queue_ = std::queue<std::string>(); 1319 message_queue_ = std::queue<std::string>();
1320 } 1320 }
1321 1321
1322 bool DOMMessageQueue::WaitForMessage(std::string* message) { 1322 bool DOMMessageQueue::WaitForMessage(std::string* message) {
1323 DCHECK(message); 1323 DCHECK(message);
1324 if (message_queue_.empty()) { 1324 if (message_queue_.empty()) {
1325 // This will be quit when a new message comes in. 1325 // This will be quit when a new message comes in.
1326 message_loop_runner_ = new MessageLoopRunner; 1326 message_loop_runner_ =
1327 new MessageLoopRunner(MessageLoopRunner::QuitMode::IMMEDIATE);
1327 message_loop_runner_->Run(); 1328 message_loop_runner_->Run();
1328 } 1329 }
1329 // The queue should not be empty, unless we were quit because of a timeout. 1330 // The queue should not be empty, unless we were quit because of a timeout.
1330 if (message_queue_.empty()) 1331 if (message_queue_.empty())
1331 return false; 1332 return false;
1332 *message = message_queue_.front(); 1333 *message = message_queue_.front();
1333 message_queue_.pop(); 1334 message_queue_.pop();
1334 return true; 1335 return true;
1335 } 1336 }
1336 1337
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 IPC::IpcSecurityTestUtil::PwnMessageReceived( 1837 IPC::IpcSecurityTestUtil::PwnMessageReceived(
1837 process->GetChannel(), 1838 process->GetChannel(),
1838 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position)); 1839 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position));
1839 1840
1840 // If this started an async operation, wait for it to complete. 1841 // If this started an async operation, wait for it to complete.
1841 if (waiter.did_start_update()) 1842 if (waiter.did_start_update())
1842 waiter.WaitForEndUpdate(); 1843 waiter.WaitForEndUpdate();
1843 } 1844 }
1844 1845
1845 } // namespace content 1846 } // namespace content
OLDNEW
« no previous file with comments | « chromeos/cryptohome/mock_homedir_methods.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698