1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.h"
7 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
9 #include "content/public/browser/web_contents.h"
10 #include "content/public/common/context_menu_params.h"
12 typedef ChromeRenderViewHostTestHarness ChromeWebContentsViewDelegateViewsTest;
14 // Test that makes sure ShowContextMenu does not crash if web_contents() does
15 // not have a focused frame.
16 TEST_F(ChromeWebContentsViewDelegateViewsTest, ContextMenuNoFocusedFrame) {
17 scoped_ptr<content::WebContentsViewDelegate> delegate_view(
18 chrome::CreateWebContentsViewDelegate(web_contents()));
19 EXPECT_FALSE(web_contents()->GetFocusedFrame());
20 const content::ContextMenuParams params;
21 delegate_view->ShowContextMenu(web_contents()->GetMainFrame(), params);