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

Side by Side Diff: chrome/browser/signin/signin_browsertest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_
6 #define CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/signin/chrome_signin_client.h" 9 #include "chrome/browser/signin/chrome_signin_client.h"
10 #include "chrome/browser/signin/chrome_signin_client_factory.h" 10 #include "chrome/browser/signin/chrome_signin_client_factory.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 class BackOnNTPCommitObserver : public content::WebContentsObserver { 180 class BackOnNTPCommitObserver : public content::WebContentsObserver {
181 public: 181 public:
182 explicit BackOnNTPCommitObserver(content::WebContents* web_contents) 182 explicit BackOnNTPCommitObserver(content::WebContents* web_contents)
183 : content::WebContentsObserver(web_contents) { 183 : content::WebContentsObserver(web_contents) {
184 } 184 }
185 185
186 virtual void DidCommitProvisionalLoadForFrame( 186 virtual void DidCommitProvisionalLoadForFrame(
187 content::RenderFrameHost* render_frame_host, 187 content::RenderFrameHost* render_frame_host,
188 const GURL& url, 188 const GURL& url,
189 content::PageTransition transition_type) OVERRIDE { 189 ui::PageTransition transition_type) OVERRIDE {
190 if (url == GURL(chrome::kChromeUINewTabURL) || 190 if (url == GURL(chrome::kChromeUINewTabURL) ||
191 url == GURL(chrome::kChromeSearchLocalNtpUrl)) { 191 url == GURL(chrome::kChromeSearchLocalNtpUrl)) {
192 content::WindowedNotificationObserver observer( 192 content::WindowedNotificationObserver observer(
193 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 193 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
194 content::NotificationService::AllSources()); 194 content::NotificationService::AllSources());
195 web_contents()->GetController().GoBack(); 195 web_contents()->GetController().GoBack();
196 observer.Wait(); 196 observer.Wait();
197 } 197 }
198 } 198 }
199 199
(...skipping 18 matching lines...) Expand all
218 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); 218 EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess());
219 219
220 content::WebContents* web_contents = 220 content::WebContents* web_contents =
221 browser()->tab_strip_model()->GetActiveWebContents(); 221 browser()->tab_strip_model()->GetActiveWebContents();
222 222
223 // Simulate clicking on the Skip for now link. It's important to have a 223 // Simulate clicking on the Skip for now link. It's important to have a
224 // link transition so that OneClickSigninHelper removes the blank page 224 // link transition so that OneClickSigninHelper removes the blank page
225 // from the history. 225 // from the history.
226 chrome::NavigateParams navigate_params(browser(), 226 chrome::NavigateParams navigate_params(browser(),
227 skip_url, 227 skip_url,
228 content::PAGE_TRANSITION_LINK); 228 ui::PAGE_TRANSITION_LINK);
229 ui_test_utils::NavigateToURL(&navigate_params); 229 ui_test_utils::NavigateToURL(&navigate_params);
230 230
231 // Register an observer that will navigate back immediately on the commit of 231 // Register an observer that will navigate back immediately on the commit of
232 // the NTP. This will allow us to hit the race condition of navigating back 232 // the NTP. This will allow us to hit the race condition of navigating back
233 // before the DidStopLoading message of NTP gets delivered. This must be 233 // before the DidStopLoading message of NTP gets delivered. This must be
234 // created after the navigation to the skip_url has finished loading, 234 // created after the navigation to the skip_url has finished loading,
235 // otherwise this observer will navigate back, before the history cleaner 235 // otherwise this observer will navigate back, before the history cleaner
236 // has had a chance to remove the navigation entry. 236 // has had a chance to remove the navigation entry.
237 BackOnNTPCommitObserver commit_observer(web_contents); 237 BackOnNTPCommitObserver commit_observer(web_contents);
238 238
239 // Since OneClickSigninHelper aborts redirect to NTP, thus we expect the 239 // Since OneClickSigninHelper aborts redirect to NTP, thus we expect the
240 // visible URL to be the starting URL. 240 // visible URL to be the starting URL.
241 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL()); 241 EXPECT_EQ(skip_url, web_contents->GetLastCommittedURL());
242 EXPECT_EQ(start_url, web_contents->GetVisibleURL()); 242 EXPECT_EQ(start_url, web_contents->GetVisibleURL());
243 243
244 content::WindowedNotificationObserver observer( 244 content::WindowedNotificationObserver observer(
245 content::NOTIFICATION_LOAD_STOP, 245 content::NOTIFICATION_LOAD_STOP,
246 content::NotificationService::AllSources()); 246 content::NotificationService::AllSources());
247 observer.Wait(); 247 observer.Wait();
248 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL()); 248 EXPECT_EQ(start_url, web_contents->GetLastCommittedURL());
249 } 249 }
250 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_ 250 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_BROWSERTEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_browsertest.cc ('k') | chrome/browser/signin/signin_header_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698