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

Side by Side Diff: chrome/browser/apps/ephemeral_app_browsertest.cc

Issue 668903002: Standardize usage of virtual/override/final in chrome/browser/apps/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "chrome/browser/apps/ephemeral_app_browsertest.h" 5 #include "chrome/browser/apps/ephemeral_app_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/app_restore_service.h" 9 #include "apps/app_restore_service.h"
10 #include "apps/saved_files_service.h" 10 #include "apps/saved_files_service.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const std::string& id, 98 const std::string& id,
99 bool is_update, 99 bool is_update,
100 bool from_ephemeral) 100 bool from_ephemeral)
101 : id(id), is_update(is_update), from_ephemeral(from_ephemeral) {} 101 : id(id), is_update(is_update), from_ephemeral(from_ephemeral) {}
102 }; 102 };
103 103
104 explicit InstallObserver(Profile* profile) : registry_observer_(this) { 104 explicit InstallObserver(Profile* profile) : registry_observer_(this) {
105 registry_observer_.Add(ExtensionRegistry::Get(profile)); 105 registry_observer_.Add(ExtensionRegistry::Get(profile));
106 } 106 }
107 107
108 virtual ~InstallObserver() {} 108 ~InstallObserver() override {}
109 109
110 const InstallParameters& Last() { 110 const InstallParameters& Last() {
111 CHECK(!install_params_.empty()); 111 CHECK(!install_params_.empty());
112 return install_params_.back(); 112 return install_params_.back();
113 } 113 }
114 114
115 private: 115 private:
116 virtual void OnExtensionWillBeInstalled( 116 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
117 content::BrowserContext* browser_context, 117 const Extension* extension,
118 const Extension* extension, 118 bool is_update,
119 bool is_update, 119 bool from_ephemeral,
120 bool from_ephemeral, 120 const std::string& old_name) override {
121 const std::string& old_name) override {
122 install_params_.push_back( 121 install_params_.push_back(
123 InstallParameters(extension->id(), is_update, from_ephemeral)); 122 InstallParameters(extension->id(), is_update, from_ephemeral));
124 } 123 }
125 124
126 std::vector<InstallParameters> install_params_; 125 std::vector<InstallParameters> install_params_;
127 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 126 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
128 registry_observer_; 127 registry_observer_;
129 }; 128 };
130 129
131 // Instead of actually changing the system power settings, tests will just 130 // Instead of actually changing the system power settings, tests will just
(...skipping 19 matching lines...) Expand all
151 150
152 // Stub implementation of content::PowerSaveBlocker that updates the 151 // Stub implementation of content::PowerSaveBlocker that updates the
153 // PowerSettingsMock. 152 // PowerSettingsMock.
154 class PowerSaveBlockerStub : public content::PowerSaveBlocker { 153 class PowerSaveBlockerStub : public content::PowerSaveBlocker {
155 public: 154 public:
156 explicit PowerSaveBlockerStub(PowerSettingsMock* power_settings) 155 explicit PowerSaveBlockerStub(PowerSettingsMock* power_settings)
157 : power_settings_(power_settings) { 156 : power_settings_(power_settings) {
158 power_settings_->request_keep_awake(); 157 power_settings_->request_keep_awake();
159 } 158 }
160 159
161 virtual ~PowerSaveBlockerStub() { power_settings_->release_keep_awake(); } 160 ~PowerSaveBlockerStub() override { power_settings_->release_keep_awake(); }
162 161
163 static scoped_ptr<PowerSaveBlocker> Create(PowerSettingsMock* power_settings, 162 static scoped_ptr<PowerSaveBlocker> Create(PowerSettingsMock* power_settings,
164 PowerSaveBlockerType type, 163 PowerSaveBlockerType type,
165 const std::string& reason) { 164 const std::string& reason) {
166 return scoped_ptr<PowerSaveBlocker>( 165 return scoped_ptr<PowerSaveBlocker>(
167 new PowerSaveBlockerStub(power_settings)); 166 new PowerSaveBlockerStub(power_settings));
168 } 167 }
169 168
170 private: 169 private:
171 PowerSettingsMock* power_settings_; // Not owned. 170 PowerSettingsMock* power_settings_; // Not owned.
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); 1032 base::Bind(&PowerSaveBlockerStub::Create, &power_settings));
1034 1033
1035 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); 1034 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp);
1036 ASSERT_TRUE(app); 1035 ASSERT_TRUE(app);
1037 EXPECT_EQ(1, power_settings.keep_awake_count()); 1036 EXPECT_EQ(1, power_settings.keep_awake_count());
1038 1037
1039 CloseAppWaitForUnload(app->id()); 1038 CloseAppWaitForUnload(app->id());
1040 1039
1041 EXPECT_EQ(0, power_settings.keep_awake_count()); 1040 EXPECT_EQ(0, power_settings.keep_awake_count());
1042 } 1041 }
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_browsertest.h ('k') | chrome/browser/apps/ephemeral_app_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698