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

Side by Side Diff: chrome/browser/extensions/extension_install_prompt_test_helper.h

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_HELPER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_HELPER_H_
7
8 #include "base/macros.h"
9 #include "chrome/browser/extensions/extension_install_prompt.h"
10
11 // A helper class to be used with ExtensionInstallPrompt that keeps track of the
12 // result. Note that this class does no lifetime management.
13 class ExtensionInstallPromptTestHelper {
14 public:
15 ExtensionInstallPromptTestHelper();
16 explicit ExtensionInstallPromptTestHelper(const base::Closure& quit_closure);
17 ~ExtensionInstallPromptTestHelper();
18
19 // Returns a callback to be used with the ExtensionInstallPrompt.
20 ExtensionInstallPrompt::DoneCallback GetCallback();
21
22 // Note: This ADD_FAILURE()s if result_ has not been set.
23 ExtensionInstallPrompt::Result result() const;
24
25 bool has_result() const { return result_.get() != nullptr; }
26
27 private:
28 void HandleResult(ExtensionInstallPrompt::Result result);
29
30 scoped_ptr<ExtensionInstallPrompt::Result> result_;
31
32 // A closure to run once HandleResult() has been called; used for exiting
33 // run loops in tests.
34 base::Closure quit_closure_;
35
36 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPromptTestHelper);
37 };
38
39 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698