OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate
_views.h" | 5 #include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate
_views.h" |
6 | 6 |
7 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.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" | 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/context_menu_params.h" | 10 #include "content/public/common/context_menu_params.h" |
11 | 11 |
12 typedef ChromeRenderViewHostTestHarness ChromeWebContentsViewDelegateViewsTest; | 12 typedef ChromeRenderViewHostTestHarness ChromeWebContentsViewDelegateViewsTest; |
13 | 13 |
14 // Test that makes sure ShowContextMenu does not crash if web_contents() does | 14 // Test that makes sure ShowContextMenu does not crash if web_contents() does |
15 // not have a focused frame. | 15 // not have a focused frame. |
16 TEST_F(ChromeWebContentsViewDelegateViewsTest, ContextMenuNoFocusedFrame) { | 16 TEST_F(ChromeWebContentsViewDelegateViewsTest, ContextMenuNoFocusedFrame) { |
17 scoped_ptr<content::WebContentsViewDelegate> delegate_view( | 17 std::unique_ptr<content::WebContentsViewDelegate> delegate_view( |
18 chrome::CreateWebContentsViewDelegate(web_contents())); | 18 chrome::CreateWebContentsViewDelegate(web_contents())); |
19 EXPECT_FALSE(web_contents()->GetFocusedFrame()); | 19 EXPECT_FALSE(web_contents()->GetFocusedFrame()); |
20 const content::ContextMenuParams params; | 20 const content::ContextMenuParams params; |
21 delegate_view->ShowContextMenu(web_contents()->GetMainFrame(), params); | 21 delegate_view->ShowContextMenu(web_contents()->GetMainFrame(), params); |
22 } | 22 } |
OLD | NEW |