OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
28 #include "base/mac/scoped_nsautorelease_pool.h" | 28 #include "base/mac/scoped_nsautorelease_pool.h" |
29 #endif | 29 #endif |
30 | 30 |
31 using extensions::Extension; | 31 using extensions::Extension; |
32 | 32 |
33 class PanelExtensionBrowserTest : public ExtensionBrowserTest { | 33 class PanelExtensionBrowserTest : public ExtensionBrowserTest { |
34 protected: | 34 protected: |
35 void SetUpCommandLine(CommandLine* command_line) override { | 35 void SetUpCommandLine(base::CommandLine* command_line) override { |
36 ExtensionBrowserTest::SetUpCommandLine(command_line); | 36 ExtensionBrowserTest::SetUpCommandLine(command_line); |
37 command_line->AppendSwitch(switches::kEnablePanels); | 37 command_line->AppendSwitch(switches::kEnablePanels); |
38 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 38 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
39 test_data_dir_ = test_data_dir_.AppendASCII("panels"); | 39 test_data_dir_ = test_data_dir_.AppendASCII("panels"); |
40 } | 40 } |
41 | 41 |
42 Panel* CreatePanelFromExtension(const Extension* extension) const { | 42 Panel* CreatePanelFromExtension(const Extension* extension) const { |
43 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
44 // Opening panels on a Mac causes NSWindowController of the Panel window | 44 // Opening panels on a Mac causes NSWindowController of the Panel window |
45 // to be autoreleased. We need a pool drained after it's done so the test | 45 // to be autoreleased. We need a pool drained after it's done so the test |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 EXPECT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); | 268 EXPECT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); |
269 | 269 |
270 // Execute the extension's custom menu item and wait for the extension's | 270 // Execute the extension's custom menu item and wait for the extension's |
271 // script to tell us its onclick fired. | 271 // script to tell us its onclick fired. |
272 ExtensionTestMessageListener onclick_listener("clicked", false); | 272 ExtensionTestMessageListener onclick_listener("clicked", false); |
273 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; | 273 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; |
274 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); | 274 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); |
275 menu->ExecuteCommand(command_id, 0); | 275 menu->ExecuteCommand(command_id, 0); |
276 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); | 276 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); |
277 } | 277 } |
OLD | NEW |