Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / tab_contents / chrome_web_contents_view_delegate_views_unittest.cc
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.
4
5 #include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.h"
6
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"
10
11 class ChromeWebContentsViewDelegateViewsTest
12     : public ChromeRenderViewHostTestHarness {
13  public:
14   ChromeWebContentsViewDelegateViewsTest() {}
15
16  private:
17   DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateViewsTest);
18 };
19
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);
28 }