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

Side by Side Diff: chrome/browser/ui/panels/panel_extension_browsertest.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 10 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 15 matching lines...) Expand all
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 #if defined(OS_MACOSX) 28 #if defined(OS_MACOSX)
29 #include "base/mac/scoped_nsautorelease_pool.h" 29 #include "base/mac/scoped_nsautorelease_pool.h"
30 #endif 30 #endif
31 31
32 using extensions::Extension; 32 using extensions::Extension;
33 33
34 class PanelExtensionBrowserTest : public ExtensionBrowserTest { 34 class PanelExtensionBrowserTest : public ExtensionBrowserTest {
35 protected: 35 protected:
36 virtual void SetUpCommandLine(CommandLine* command_line) override { 36 void SetUpCommandLine(CommandLine* command_line) override {
37 ExtensionBrowserTest::SetUpCommandLine(command_line); 37 ExtensionBrowserTest::SetUpCommandLine(command_line);
38 command_line->AppendSwitch(switches::kEnablePanels); 38 command_line->AppendSwitch(switches::kEnablePanels);
39 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); 39 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_);
40 test_data_dir_ = test_data_dir_.AppendASCII("panels"); 40 test_data_dir_ = test_data_dir_.AppendASCII("panels");
41 } 41 }
42 42
43 Panel* CreatePanelFromExtension(const Extension* extension) const { 43 Panel* CreatePanelFromExtension(const Extension* extension) const {
44 #if defined(OS_MACOSX) 44 #if defined(OS_MACOSX)
45 // Opening panels on a Mac causes NSWindowController of the Panel window 45 // Opening panels on a Mac causes NSWindowController of the Panel window
46 // to be autoreleased. We need a pool drained after it's done so the test 46 // to be autoreleased. We need a pool drained after it's done so the test
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 PanelContextMenu(content::RenderFrameHost* render_frame_host, 118 PanelContextMenu(content::RenderFrameHost* render_frame_host,
119 const content::ContextMenuParams& params) 119 const content::ContextMenuParams& params)
120 : RenderViewContextMenu(render_frame_host, params) {} 120 : RenderViewContextMenu(render_frame_host, params) {}
121 121
122 bool HasCommandWithId(int command_id) { 122 bool HasCommandWithId(int command_id) {
123 return menu_model_.GetIndexOfCommandId(command_id) != -1; 123 return menu_model_.GetIndexOfCommandId(command_id) != -1;
124 } 124 }
125 125
126 protected: 126 protected:
127 // RenderViewContextMenu implementation. 127 // RenderViewContextMenu implementation.
128 virtual bool GetAcceleratorForCommandId( 128 bool GetAcceleratorForCommandId(int command_id,
129 int command_id, 129 ui::Accelerator* accelerator) override {
130 ui::Accelerator* accelerator) override {
131 return false; 130 return false;
132 } 131 }
133 }; 132 };
134 133
135 IN_PROC_BROWSER_TEST_F(PanelExtensionBrowserTest, BasicContextMenu) { 134 IN_PROC_BROWSER_TEST_F(PanelExtensionBrowserTest, BasicContextMenu) {
136 ExtensionTestMessageListener listener("panel loaded", false); 135 ExtensionTestMessageListener listener("panel loaded", false);
137 LoadExtension(test_data_dir_.AppendASCII("basic")); 136 LoadExtension(test_data_dir_.AppendASCII("basic"));
138 ASSERT_TRUE(listener.WaitUntilSatisfied()); 137 ASSERT_TRUE(listener.WaitUntilSatisfied());
139 138
140 // There should only be one panel. 139 // There should only be one panel.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 EXPECT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); 267 EXPECT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPYLINKLOCATION));
269 268
270 // Execute the extension's custom menu item and wait for the extension's 269 // Execute the extension's custom menu item and wait for the extension's
271 // script to tell us its onclick fired. 270 // script to tell us its onclick fired.
272 ExtensionTestMessageListener onclick_listener("clicked", false); 271 ExtensionTestMessageListener onclick_listener("clicked", false);
273 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; 272 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST;
274 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); 273 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id));
275 menu->ExecuteCommand(command_id, 0); 274 menu->ExecuteCommand(command_id, 0);
276 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); 275 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied());
277 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698