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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_browsertest.cc

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 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 | Annotate | Revision Log
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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 7 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_test_message_listener.h" 9 #include "chrome/browser/extensions/extension_test_message_listener.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/tab_contents/render_view_context_menu.h" 11 #include "chrome/browser/tab_contents/render_view_context_menu.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h" 13 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/common/context_menu_params.h" 15 #include "content/public/common/context_menu_params.h"
16 #include "net/base/mock_host_resolver.h" 16 #include "net/base/mock_host_resolver.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
18 #include "ui/base/models/menu_model.h" 18 #include "ui/base/models/menu_model.h"
19 19
20 using WebKit::WebContextMenuData; 20 using WebKit::WebContextMenuData;
21 using content::WebContents; 21 using content::WebContents;
22 using ui::MenuModel; 22 using ui::MenuModel;
23 23
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 ASSERT_TRUE(LoadContextMenuExtensionIncognito("incognito")); 451 ASSERT_TRUE(LoadContextMenuExtensionIncognito("incognito"));
452 452
453 // Wait for the extension's processes to tell us they've created an item. 453 // Wait for the extension's processes to tell us they've created an item.
454 ASSERT_TRUE(created.WaitUntilSatisfied()); 454 ASSERT_TRUE(created.WaitUntilSatisfied());
455 ASSERT_TRUE(created_incognito.WaitUntilSatisfied()); 455 ASSERT_TRUE(created_incognito.WaitUntilSatisfied());
456 456
457 GURL page_url("http://www.google.com"); 457 GURL page_url("http://www.google.com");
458 458
459 // Create and build our test context menu. 459 // Create and build our test context menu.
460 Browser* browser_incognito = BrowserList::FindTabbedBrowser( 460 Browser* browser_incognito = browser::FindTabbedBrowser(
461 browser()->profile()->GetOffTheRecordProfile(), false); 461 browser()->profile()->GetOffTheRecordProfile(), false);
462 ASSERT_TRUE(browser_incognito); 462 ASSERT_TRUE(browser_incognito);
463 scoped_ptr<TestRenderViewContextMenu> menu( 463 scoped_ptr<TestRenderViewContextMenu> menu(
464 CreateMenu(browser(), page_url, GURL(), GURL())); 464 CreateMenu(browser(), page_url, GURL(), GURL()));
465 scoped_ptr<TestRenderViewContextMenu> menu_incognito( 465 scoped_ptr<TestRenderViewContextMenu> menu_incognito(
466 CreateMenu(browser_incognito, page_url, GURL(), GURL())); 466 CreateMenu(browser_incognito, page_url, GURL(), GURL()));
467 467
468 // Look for the extension item in the menu, and execute it. 468 // Look for the extension item in the menu, and execute it.
469 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; 469 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST;
470 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); 470 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id));
(...skipping 30 matching lines...) Expand all
501 page_url, GURL(), frame_url, std::string("Page item"))); 501 page_url, GURL(), frame_url, std::string("Page item")));
502 ASSERT_TRUE(MenuHasItemWithLabel( 502 ASSERT_TRUE(MenuHasItemWithLabel(
503 page_url, GURL(), frame_url, std::string("Frame item"))); 503 page_url, GURL(), frame_url, std::string("Frame item")));
504 } 504 }
505 505
506 // Tests enabling and disabling a context menu item. 506 // Tests enabling and disabling a context menu item.
507 IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserTest, Enabled) { 507 IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserTest, Enabled) {
508 TestEnabledContextMenu(true); 508 TestEnabledContextMenu(true);
509 TestEnabledContextMenu(false); 509 TestEnabledContextMenu(false);
510 } 510 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698