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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 282 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
283 | 283 |
284 // Wait for context menu to be visible. | 284 // Wait for context menu to be visible. |
285 menu_observer.WaitForMenuOpenAndClose(); | 285 menu_observer.WaitForMenuOpenAndClose(); |
286 | 286 |
287 // Compare filename. | 287 // Compare filename. |
288 base::string16 suggested_filename = menu_observer.params().suggested_filename; | 288 base::string16 suggested_filename = menu_observer.params().suggested_filename; |
289 ASSERT_EQ(kSuggestedFilename, base::UTF16ToUTF8(suggested_filename).c_str()); | 289 ASSERT_EQ(kSuggestedFilename, base::UTF16ToUTF8(suggested_filename).c_str()); |
290 } | 290 } |
291 | 291 |
292 // Ensure that View Page Info won't crash if there is no visible entry. | 292 // Ensure that View Page Info won't crash on the initial navigation. |
293 // See http://crbug.com/370863. | 293 // See http://crbug.com/370863. |
294 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ViewPageInfoWithNoEntry) { | 294 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ViewPageInfoOnInitialPage) { |
295 // Create a new tab with no committed entry. | 295 // Create a new tab on the initial blank page. |
296 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer( | 296 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer( |
297 content::NotificationService::AllSources()); | 297 content::NotificationService::AllSources()); |
298 ASSERT_TRUE(content::ExecuteScript( | 298 ASSERT_TRUE(content::ExecuteScript( |
299 browser()->tab_strip_model()->GetActiveWebContents(), "window.open();")); | 299 browser()->tab_strip_model()->GetActiveWebContents(), "window.open();")); |
300 tab_observer.Wait(); | 300 tab_observer.Wait(); |
301 content::WebContents* tab = tab_observer.GetTab(); | 301 content::WebContents* tab = tab_observer.GetTab(); |
302 EXPECT_FALSE(tab->GetController().GetLastCommittedEntry()); | 302 EXPECT_TRUE(tab->GetController().IsInitialBlankNavigation()); |
303 EXPECT_FALSE(tab->GetController().GetVisibleEntry()); | 303 EXPECT_TRUE(tab->GetController().GetVisibleEntry()); |
304 | 304 |
305 // Create a context menu. | 305 // Create a context menu. |
306 content::ContextMenuParams context_menu_params; | 306 content::ContextMenuParams context_menu_params; |
307 TestRenderViewContextMenu menu(tab->GetMainFrame(), context_menu_params); | 307 TestRenderViewContextMenu menu(tab->GetMainFrame(), context_menu_params); |
308 menu.Init(); | 308 menu.Init(); |
309 | 309 |
310 // The item shouldn't be enabled in the menu. | 310 // The item shouldn't be enabled in the menu. |
311 EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO)); | 311 EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO)); |
312 | 312 |
313 // Ensure that viewing page info doesn't crash even if you can get to it. | 313 // Ensure that viewing page info doesn't crash even if you can get to it. |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { | 646 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { |
647 static const char kValidImage[] = "files/load_image/image.png"; | 647 static const char kValidImage[] = "files/load_image/image.png"; |
648 SetupAndLoadImagePage(kValidImage); | 648 SetupAndLoadImagePage(kValidImage); |
649 AddLoadImageInterceptor(kValidImage); | 649 AddLoadImageInterceptor(kValidImage); |
650 AttemptLoadImage(); | 650 AttemptLoadImage(); |
651 interceptor_->WaitForRequests(1); | 651 interceptor_->WaitForRequests(1); |
652 EXPECT_EQ(1, interceptor_->num_requests()); | 652 EXPECT_EQ(1, interceptor_->num_requests()); |
653 } | 653 } |
654 | 654 |
655 } // namespace | 655 } // namespace |
OLD | NEW |