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 #ifndef EXTENSIONS_BROWSER_PRELOAD_CHECK_TEST_UTIL_H_ |
| 6 #define EXTENSIONS_BROWSER_PRELOAD_CHECK_TEST_UTIL_H_ |
| 7 |
| 8 #include "extensions/browser/preload_check.h" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 // Provides a callback method for a PreloadCheck that stores its results. |
| 13 class PreloadCheckRunner { |
| 14 public: |
| 15 PreloadCheckRunner(); |
| 16 virtual ~PreloadCheckRunner(); |
| 17 |
| 18 // Starts the check and waits for its callback to execute. |
| 19 void RunUntilComplete(PreloadCheck* check); |
| 20 |
| 21 // Waits to give asynchronous tasks a chance to complete. |
| 22 void Wait(); |
| 23 |
| 24 PreloadCheck::ResultCallback GetCallback(); |
| 25 |
| 26 const PreloadCheck::Errors& errors() const { return errors_; } |
| 27 bool called() const { return called_; } |
| 28 |
| 29 private: |
| 30 void OnCheckComplete(PreloadCheck::Errors errors); |
| 31 |
| 32 PreloadCheck::Errors errors_; |
| 33 bool called_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(PreloadCheckRunner); |
| 36 }; |
| 37 |
| 38 } // namespace extensions |
| 39 |
| 40 #endif // EXTENSIONS_BROWSER_PRELOAD_CHECK_TEST_UTIL_H_ |
OLD | NEW |