Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "extensions/browser/preload_check_test_util.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/run_loop.h" | |
| 9 | |
| 10 namespace extensions { | |
| 11 | |
| 12 PreloadCheckObserver::PreloadCheckObserver() : called_(false) {} | |
| 13 PreloadCheckObserver::~PreloadCheckObserver() {} | |
| 14 | |
| 15 void PreloadCheckObserver::OnCheckComplete(PreloadCheck::Errors errors) { | |
| 16 CHECK(!called_); | |
|
Devlin
2017/03/14 01:44:34
Can we ASSERT_FALSE here?
michaelpg
2017/03/14 21:58:30
I'd prefer not to #include gtest.h here. I'd rathe
Devlin
2017/03/16 01:42:44
Any particular reason? It's already a test-only f
michaelpg
2017/03/17 02:34:26
Meh. The crash does look uglier, so Done.
| |
| 17 called_ = true; | |
| 18 errors_ = errors; | |
| 19 } | |
| 20 | |
| 21 void PreloadCheckObserver::Wait() { | |
| 22 if (called_) | |
| 23 return; | |
| 24 | |
| 25 base::RunLoop().RunUntilIdle(); | |
|
Devlin
2017/03/14 01:44:34
This can be pretty finicky, given post task comple
michaelpg
2017/03/14 21:58:30
Can you expand on "finicky", please? I copied this
Devlin
2017/03/16 01:42:44
The finicky bits are when RunUntilIdle() doesn't a
michaelpg
2017/03/17 02:34:26
Meh again. How about using two functions, WaitForC
| |
| 26 } | |
| 27 | |
| 28 } // namespace extensions | |
| OLD | NEW |