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/test/base/chrome_render_view_host_test_harness.h"
8 #include "content/public/browser/web_contents.h"
9 #include "content/public/common/context_menu_params.h"
11 class ChromeWebContentsViewDelegateViewsTest
12 : public ChromeRenderViewHostTestHarness {
14 ChromeWebContentsViewDelegateViewsTest() {}
17 DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateViewsTest);
20 // Test that makes sure ShowContextMenu does not crash if web_contents() does
21 // not have a focused frame.
22 TEST_F(ChromeWebContentsViewDelegateViewsTest, ContextMenuNoFocusedFrame) {
23 scoped_ptr<ChromeWebContentsViewDelegateViews> delegate_view(
24 new ChromeWebContentsViewDelegateViews(web_contents()));
25 EXPECT_FALSE(web_contents()->GetFocusedFrame());
26 const content::ContextMenuParams params;
27 delegate_view->ShowContextMenu(web_contents()->GetMainFrame(), params);