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

Side by Side Diff: chrome/browser/browser_commands_unittest.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/app/chrome_command_ids.h" 5 #include "chrome/app/chrome_command_ids.h"
6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 6 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
7 #include "chrome/browser/chrome_page_zoom.h" 7 #include "chrome/browser/chrome_page_zoom.h"
8 #include "chrome/browser/ui/browser_command_controller.h" 8 #include "chrome/browser/ui/browser_command_controller.h"
9 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 GURL url3("http://foo/3"); 64 GURL url3("http://foo/3");
65 GURL url4("http://foo/4"); 65 GURL url4("http://foo/4");
66 66
67 // Navigate to three urls, plus a pending URL that hasn't committed. 67 // Navigate to three urls, plus a pending URL that hasn't committed.
68 AddTab(browser(), url1); 68 AddTab(browser(), url1);
69 NavigateAndCommitActiveTab(url2); 69 NavigateAndCommitActiveTab(url2);
70 NavigateAndCommitActiveTab(url3); 70 NavigateAndCommitActiveTab(url3);
71 content::NavigationController& orig_controller = 71 content::NavigationController& orig_controller =
72 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); 72 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
73 orig_controller.LoadURL( 73 orig_controller.LoadURL(
74 url4, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 74 url4, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
75 EXPECT_EQ(3, orig_controller.GetEntryCount()); 75 EXPECT_EQ(3, orig_controller.GetEntryCount());
76 EXPECT_TRUE(orig_controller.GetPendingEntry()); 76 EXPECT_TRUE(orig_controller.GetPendingEntry());
77 77
78 size_t initial_window_count = chrome::GetTotalBrowserCount(); 78 size_t initial_window_count = chrome::GetTotalBrowserCount();
79 79
80 // Duplicate the tab. 80 // Duplicate the tab.
81 chrome::ExecuteCommand(browser(), IDC_DUPLICATE_TAB); 81 chrome::ExecuteCommand(browser(), IDC_DUPLICATE_TAB);
82 82
83 // The duplicated tab should not end up in a new window. 83 // The duplicated tab should not end up in a new window.
84 size_t window_count = chrome::GetTotalBrowserCount(); 84 size_t window_count = chrome::GetTotalBrowserCount();
(...skipping 16 matching lines...) Expand all
101 // Tests IDC_VIEW_SOURCE (See http://crbug.com/138140). 101 // Tests IDC_VIEW_SOURCE (See http://crbug.com/138140).
102 TEST_F(BrowserCommandsTest, ViewSource) { 102 TEST_F(BrowserCommandsTest, ViewSource) {
103 GURL url1("http://foo/1"); 103 GURL url1("http://foo/1");
104 GURL url2("http://foo/2"); 104 GURL url2("http://foo/2");
105 105
106 // Navigate to a URL, plus a pending URL that hasn't committed. 106 // Navigate to a URL, plus a pending URL that hasn't committed.
107 AddTab(browser(), url1); 107 AddTab(browser(), url1);
108 content::NavigationController& orig_controller = 108 content::NavigationController& orig_controller =
109 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); 109 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
110 orig_controller.LoadURL( 110 orig_controller.LoadURL(
111 url2, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 111 url2, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
112 EXPECT_EQ(1, orig_controller.GetEntryCount()); 112 EXPECT_EQ(1, orig_controller.GetEntryCount());
113 EXPECT_TRUE(orig_controller.GetPendingEntry()); 113 EXPECT_TRUE(orig_controller.GetPendingEntry());
114 114
115 size_t initial_window_count = chrome::GetTotalBrowserCount(); 115 size_t initial_window_count = chrome::GetTotalBrowserCount();
116 116
117 // View Source. 117 // View Source.
118 chrome::ExecuteCommand(browser(), IDC_VIEW_SOURCE); 118 chrome::ExecuteCommand(browser(), IDC_VIEW_SOURCE);
119 119
120 // The view source tab should not end up in a new window. 120 // The view source tab should not end up in a new window.
121 size_t window_count = chrome::GetTotalBrowserCount(); 121 size_t window_count = chrome::GetTotalBrowserCount();
(...skipping 17 matching lines...) Expand all
139 // We use profile() here, since it's a TestingProfile. 139 // We use profile() here, since it's a TestingProfile.
140 profile()->CreateBookmarkModel(true); 140 profile()->CreateBookmarkModel(true);
141 141
142 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); 142 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
143 test::WaitForBookmarkModelToLoad(model); 143 test::WaitForBookmarkModelToLoad(model);
144 144
145 // Navigate to a url. 145 // Navigate to a url.
146 GURL url1("http://foo/1"); 146 GURL url1("http://foo/1");
147 AddTab(browser(), url1); 147 AddTab(browser(), url1);
148 browser()->OpenURL(OpenURLParams( 148 browser()->OpenURL(OpenURLParams(
149 url1, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 149 url1, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false));
150 150
151 chrome::BookmarkCurrentPage(browser()); 151 chrome::BookmarkCurrentPage(browser());
152 152
153 // It should now be bookmarked in the bookmark model. 153 // It should now be bookmarked in the bookmark model.
154 EXPECT_EQ(profile(), browser()->profile()); 154 EXPECT_EQ(profile(), browser()->profile());
155 EXPECT_TRUE(model->IsBookmarked(url1)); 155 EXPECT_TRUE(model->IsBookmarked(url1));
156 } 156 }
157 157
158 // Tests back/forward in new tab (Control + Back/Forward button in the UI). 158 // Tests back/forward in new tab (Control + Back/Forward button in the UI).
159 TEST_F(BrowserCommandsTest, BackForwardInNewTab) { 159 TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 tab_strip_model->ActivateTabAt(1, true); 332 tab_strip_model->ActivateTabAt(1, true);
333 EXPECT_TRUE(tab_strip_model->IsTabSelected(1)); 333 EXPECT_TRUE(tab_strip_model->IsTabSelected(1));
334 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT); 334 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT);
335 335
336 zoom_controller = ZoomController::FromWebContents(contents2); 336 zoom_controller = ZoomController::FromWebContents(contents2);
337 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f); 337 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f);
338 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS)); 338 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL)); 339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS)); 340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
341 } 341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698