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

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

Issue 2693373003: PreloadCheck class for extension pre-install checks (Closed)
Patch Set: devlin 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
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 #include "extensions/browser/preload_check_test_util.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/logging.h"
10 #include "base/run_loop.h"
11
12 namespace extensions {
13
14 PreloadCheckRunner::PreloadCheckRunner() : called_(false) {}
15 PreloadCheckRunner::~PreloadCheckRunner() {}
16
17 void PreloadCheckRunner::OnCheckComplete(PreloadCheck::Errors errors) {
18 CHECK(!called_);
19 called_ = true;
20 errors_ = errors;
21 }
22
23 void PreloadCheckRunner::RunUntilComplete(PreloadCheck* check) {
24 check->Start(GetCallback());
25 CHECK(!called_);
26 Wait();
27 CHECK(called_);
28 }
29
30 PreloadCheck::ResultCallback PreloadCheckRunner::GetCallback() {
31 return base::Bind(&PreloadCheckRunner::OnCheckComplete,
32 base::Unretained(this));
33 }
34
35 void PreloadCheckRunner::Wait() {
36 base::RunLoop().RunUntilIdle();
37 }
38
39 } // namespace extensions
OLDNEW
« extensions/browser/preload_check.h ('K') | « extensions/browser/preload_check_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698