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

Side by Side Diff: chrome/browser/extensions/extension_reenabler_unittest.cc

Issue 2152373003: [Extensions] Code Cleanup - Remove redundant smart-ptr get()s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/macros.h" 5 #include "base/macros.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "chrome/browser/extensions/extension_install_prompt.h" 7 #include "chrome/browser/extensions/extension_install_prompt.h"
8 #include "chrome/browser/extensions/extension_reenabler.h" 8 #include "chrome/browser/extensions/extension_reenabler.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_service_test_base.h" 10 #include "chrome/browser/extensions/extension_service_test_base.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // Get a callback to run on the completion of the reenable process and reset 52 // Get a callback to run on the completion of the reenable process and reset
53 // |result_|. 53 // |result_|.
54 ExtensionReenabler::Callback GetCallback() { 54 ExtensionReenabler::Callback GetCallback() {
55 result_.reset(); 55 result_.reset();
56 return base::Bind(&CallbackHelper::OnComplete, 56 return base::Bind(&CallbackHelper::OnComplete,
57 base::Unretained(this)); 57 base::Unretained(this));
58 } 58 }
59 59
60 // Check if we have receved any result, and if it matches the expected one. 60 // Check if we have receved any result, and if it matches the expected one.
61 bool has_result() const { return result_.get() != nullptr; } 61 bool has_result() const { return result_ != nullptr; }
62 bool result_matches(ExtensionReenabler::ReenableResult expected) const { 62 bool result_matches(ExtensionReenabler::ReenableResult expected) const {
63 return result_.get() && *result_ == expected; 63 return result_.get() && *result_ == expected;
64 } 64 }
65 65
66 // Create a test ExtensionInstallPrompt that will not display any UI (which 66 // Create a test ExtensionInstallPrompt that will not display any UI (which
67 // causes unit tests to crash), but rather runs the given |quit_closure| (with 67 // causes unit tests to crash), but rather runs the given |quit_closure| (with
68 // the prompt still active|. 68 // the prompt still active|.
69 ExtensionInstallPrompt::ShowDialogCallback CreateShowCallback( 69 ExtensionInstallPrompt::ShowDialogCallback CreateShowCallback(
70 const base::Closure& quit_closure) { 70 const base::Closure& quit_closure) {
71 quit_closure_ = quit_closure; 71 quit_closure_ = quit_closure;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 EXPECT_FALSE(callback_helper.has_result()); 259 EXPECT_FALSE(callback_helper.has_result());
260 // Destroy the reenabler to simulate the owning context being shut down 260 // Destroy the reenabler to simulate the owning context being shut down
261 // (e.g., the tab closing). 261 // (e.g., the tab closing).
262 extension_reenabler.reset(); 262 extension_reenabler.reset();
263 EXPECT_TRUE( 263 EXPECT_TRUE(
264 callback_helper.result_matches(ExtensionReenabler::ABORTED)); 264 callback_helper.result_matches(ExtensionReenabler::ABORTED));
265 } 265 }
266 } 266 }
267 267
268 } // namespace extensions 268 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_test_util.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698