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

Side by Side Diff: extensions/browser/preload_check_test_util.h

Issue 2693373003: PreloadCheck class for extension pre-install checks (Closed)
Patch Set: don't break enable_extensions=false Created 3 years, 9 months 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 | « extensions/browser/preload_check.cc ('k') | extensions/browser/preload_check_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 <memory>
9
10 #include "extensions/browser/preload_check.h"
11
12 namespace base {
13 class RunLoop;
14 }
15
16 namespace extensions {
17
18 // Provides a callback method for a PreloadCheck that stores its results.
19 class PreloadCheckRunner {
20 public:
21 PreloadCheckRunner();
22 virtual ~PreloadCheckRunner();
23
24 // Starts the check, providing OnCheckComplete as the callback.
25 void Run(PreloadCheck* check);
26
27 // Starts the check and waits for its callback to execute.
28 void RunUntilComplete(PreloadCheck* check);
29
30 // Runs the message loop until OnCheckComplete is called.
31 void WaitForCompletion();
32
33 // Runs the message loop until idle. Useful to see whether OnCheckComplete is
34 // called without waiting indefinitely.
35 void WaitForIdle();
36
37 PreloadCheck::ResultCallback GetCallback();
38
39 const PreloadCheck::Errors& errors() const { return errors_; }
40 bool called() const { return called_; }
41
42 private:
43 void OnCheckComplete(PreloadCheck::Errors errors);
44
45 PreloadCheck::Errors errors_;
46 bool called_;
47
48 // Using a RunLoop data member would trigger tricky timing troubles.
49 std::unique_ptr<base::RunLoop> run_loop_;
50
51 DISALLOW_COPY_AND_ASSIGN(PreloadCheckRunner);
52 };
53
54 } // namespace extensions
55
56 #endif // EXTENSIONS_BROWSER_PRELOAD_CHECK_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « extensions/browser/preload_check.cc ('k') | extensions/browser/preload_check_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698