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

Side by Side Diff: chrome/browser/extensions/error_console/error_console_browsertest.cc

Issue 666153002: Standardize usage of virtual/override/final in chrome/browser/extensions/ (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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/error_console/error_console.h" 5 #include "chrome/browser/extensions/error_console/error_console.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 waiting_(false), 147 waiting_(false),
148 error_console_(error_console) { 148 error_console_(error_console) {
149 error_console_->AddObserver(this); 149 error_console_->AddObserver(this);
150 } 150 }
151 virtual ~ErrorObserver() { 151 virtual ~ErrorObserver() {
152 if (error_console_) 152 if (error_console_)
153 error_console_->RemoveObserver(this); 153 error_console_->RemoveObserver(this);
154 } 154 }
155 155
156 // ErrorConsole::Observer implementation. 156 // ErrorConsole::Observer implementation.
157 virtual void OnErrorAdded(const ExtensionError* error) override { 157 void OnErrorAdded(const ExtensionError* error) override {
158 ++errors_observed_; 158 ++errors_observed_;
159 if (errors_observed_ >= errors_expected_) { 159 if (errors_observed_ >= errors_expected_) {
160 if (waiting_) 160 if (waiting_)
161 base::MessageLoopForUI::current()->Quit(); 161 base::MessageLoopForUI::current()->Quit();
162 } 162 }
163 } 163 }
164 164
165 virtual void OnErrorConsoleDestroyed() override { 165 void OnErrorConsoleDestroyed() override { error_console_ = NULL; }
166 error_console_ = NULL;
167 }
168 166
169 // Spin until the appropriate number of errors have been observed. 167 // Spin until the appropriate number of errors have been observed.
170 void WaitForErrors() { 168 void WaitForErrors() {
171 if (errors_observed_ < errors_expected_) { 169 if (errors_observed_ < errors_expected_) {
172 waiting_ = true; 170 waiting_ = true;
173 content::RunMessageLoop(); 171 content::RunMessageLoop();
174 waiting_ = false; 172 waiting_ = false;
175 } 173 }
176 } 174 }
177 175
(...skipping 14 matching lines...) Expand all
192 ACTION_NAVIGATE, 190 ACTION_NAVIGATE,
193 // Simulate a browser action click. 191 // Simulate a browser action click.
194 ACTION_BROWSER_ACTION, 192 ACTION_BROWSER_ACTION,
195 // Navigate to the new tab page. 193 // Navigate to the new tab page.
196 ACTION_NEW_TAB, 194 ACTION_NEW_TAB,
197 // Do nothing (errors will be caused by a background script, 195 // Do nothing (errors will be caused by a background script,
198 // or by a manifest/loading warning). 196 // or by a manifest/loading warning).
199 ACTION_NONE 197 ACTION_NONE
200 }; 198 };
201 199
202 virtual void SetUpInProcessBrowserTestFixture() override { 200 void SetUpInProcessBrowserTestFixture() override {
203 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); 201 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture();
204 202
205 // We need to enable the ErrorConsole FeatureSwitch in order to collect 203 // We need to enable the ErrorConsole FeatureSwitch in order to collect
206 // errors. This should be enabled on any channel <= Dev, but let's make 204 // errors. This should be enabled on any channel <= Dev, but let's make
207 // sure (in case a test is running on, e.g., a beta channel). 205 // sure (in case a test is running on, e.g., a beta channel).
208 FeatureSwitch::error_console()->SetOverrideValue( 206 FeatureSwitch::error_console()->SetOverrideValue(
209 FeatureSwitch::OVERRIDE_ENABLED); 207 FeatureSwitch::OVERRIDE_ENABLED);
210 } 208 }
211 209
212 virtual void SetUpOnMainThread() override { 210 void SetUpOnMainThread() override {
213 ExtensionBrowserTest::SetUpOnMainThread(); 211 ExtensionBrowserTest::SetUpOnMainThread();
214 212
215 // Errors are only kept if we have Developer Mode enabled. 213 // Errors are only kept if we have Developer Mode enabled.
216 profile()->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); 214 profile()->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true);
217 215
218 error_console_ = ErrorConsole::Get(profile()); 216 error_console_ = ErrorConsole::Get(profile());
219 CHECK(error_console_); 217 CHECK(error_console_);
220 218
221 test_data_dir_ = test_data_dir_.AppendASCII("error_console"); 219 test_data_dir_ = test_data_dir_.AppendASCII("error_console");
222 } 220 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 573
576 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]); 574 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]);
577 ASSERT_EQ(1u, stack_trace.size()); 575 ASSERT_EQ(1u, stack_trace.size());
578 CheckStackFrame(stack_trace[0], 576 CheckStackFrame(stack_trace[0],
579 script_url, 577 script_url,
580 kAnonymousFunction, 578 kAnonymousFunction,
581 12u, 20u); 579 12u, 20u);
582 } 580 }
583 581
584 } // namespace extensions 582 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/error_console/error_console.h ('k') | chrome/browser/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698