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

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

Issue 1804123003: [Extensions] Refactor extension action execution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 15 #include "chrome/browser/extensions/extension_action_runner.h"
16 #include "chrome/browser/extensions/extension_browsertest.h" 16 #include "chrome/browser/extensions/extension_browsertest.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 #include "chrome/test/base/ui_test_utils.h" 21 #include "chrome/test/base/ui_test_utils.h"
21 #include "components/prefs/pref_service.h" 22 #include "components/prefs/pref_service.h"
22 #include "extensions/browser/extension_error.h" 23 #include "extensions/browser/extension_error.h"
23 #include "extensions/common/constants.h" 24 #include "extensions/common/constants.h"
24 #include "extensions/common/error_utils.h" 25 #include "extensions/common/error_utils.h"
25 #include "extensions/common/extension.h" 26 #include "extensions/common/extension.h"
26 #include "extensions/common/extension_urls.h" 27 #include "extensions/common/extension_urls.h"
27 #include "extensions/common/feature_switch.h" 28 #include "extensions/common/feature_switch.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 *extension = 245 *extension =
245 LoadExtensionWithFlags(test_data_dir_.AppendASCII(path), flags); 246 LoadExtensionWithFlags(test_data_dir_.AppendASCII(path), flags);
246 ASSERT_TRUE(*extension); 247 ASSERT_TRUE(*extension);
247 248
248 switch (action) { 249 switch (action) {
249 case ACTION_NAVIGATE: { 250 case ACTION_NAVIGATE: {
250 ui_test_utils::NavigateToURL(browser(), GetTestURL()); 251 ui_test_utils::NavigateToURL(browser(), GetTestURL());
251 break; 252 break;
252 } 253 }
253 case ACTION_BROWSER_ACTION: { 254 case ACTION_BROWSER_ACTION: {
254 ExtensionActionAPI::Get(profile())->ExecuteExtensionAction( 255 ExtensionActionRunner::GetForWebContents(
255 *extension, browser(), true); 256 browser()->tab_strip_model()->GetActiveWebContents())
257 ->RunAction(*extension, true);
256 break; 258 break;
257 } 259 }
258 case ACTION_NEW_TAB: { 260 case ACTION_NEW_TAB: {
259 ui_test_utils::NavigateToURL(browser(), 261 ui_test_utils::NavigateToURL(browser(),
260 GURL(chrome::kChromeUINewTabURL)); 262 GURL(chrome::kChromeUINewTabURL));
261 break; 263 break;
262 } 264 }
263 case ACTION_NONE: 265 case ACTION_NONE:
264 break; 266 break;
265 default: 267 default:
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 586
585 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]); 587 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]);
586 ASSERT_EQ(1u, stack_trace.size()); 588 ASSERT_EQ(1u, stack_trace.size());
587 CheckStackFrame(stack_trace[0], 589 CheckStackFrame(stack_trace[0],
588 script_url, 590 script_url,
589 kAnonymousFunction, 591 kAnonymousFunction,
590 12u, 20u); 592 12u, 20u);
591 } 593 }
592 594
593 } // namespace extensions 595 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698