Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc

Issue 1309323004: Create a NavigationEntry for the initial blank page. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GetEntryCount, more tests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.cc ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698