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

Side by Side Diff: chrome/browser/infobars/infobar_service.cc

Issue 2721783002: Disable info bar animations during automated testing. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | components/infobars/core/infobar_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/infobars/infobar_service.h" 5 #include "chrome/browser/infobars/infobar_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
10 #include "components/infobars/core/infobar.h" 11 #include "components/infobars/core/infobar.h"
11 #include "content/public/browser/navigation_details.h" 12 #include "content/public/browser/navigation_details.h"
12 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "ui/base/page_transition_types.h" 16 #include "ui/base/page_transition_types.h"
16 17
17 18
18 DEFINE_WEB_CONTENTS_USER_DATA_KEY(InfoBarService); 19 DEFINE_WEB_CONTENTS_USER_DATA_KEY(InfoBarService);
(...skipping 21 matching lines...) Expand all
40 return NULL; 41 return NULL;
41 InfoBarService* infobar_service = 42 InfoBarService* infobar_service =
42 static_cast<InfoBarService*>(infobar->owner()); 43 static_cast<InfoBarService*>(infobar->owner());
43 return infobar_service->web_contents(); 44 return infobar_service->web_contents();
44 } 45 }
45 46
46 InfoBarService::InfoBarService(content::WebContents* web_contents) 47 InfoBarService::InfoBarService(content::WebContents* web_contents)
47 : content::WebContentsObserver(web_contents), 48 : content::WebContentsObserver(web_contents),
48 ignore_next_reload_(false) { 49 ignore_next_reload_(false) {
49 DCHECK(web_contents); 50 DCHECK(web_contents);
51 // Infobar animations cause viewport resizes. Disable them for automated
52 // tests, since they could lead to flakiness.
53 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
54 switches::kEnableAutomation))
55 set_animations_enabled(false);
50 } 56 }
51 57
52 InfoBarService::~InfoBarService() { 58 InfoBarService::~InfoBarService() {
53 ShutDown(); 59 ShutDown();
54 } 60 }
55 61
56 int InfoBarService::GetActiveEntryID() { 62 int InfoBarService::GetActiveEntryID() {
57 content::NavigationEntry* active_entry = 63 content::NavigationEntry* active_entry =
58 web_contents()->GetController().GetActiveEntry(); 64 web_contents()->GetController().GetActiveEntry();
59 return active_entry ? active_entry->GetUniqueID() : 0; 65 return active_entry ? active_entry->GetUniqueID() : 0;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // A normal user click on an infobar URL will result in a CURRENT_TAB 124 // A normal user click on an infobar URL will result in a CURRENT_TAB
119 // disposition; turn that into a NEW_FOREGROUND_TAB so that we don't end up 125 // disposition; turn that into a NEW_FOREGROUND_TAB so that we don't end up
120 // smashing the page the user is looking at. 126 // smashing the page the user is looking at.
121 web_contents()->OpenURL( 127 web_contents()->OpenURL(
122 content::OpenURLParams(url, content::Referrer(), 128 content::OpenURLParams(url, content::Referrer(),
123 (disposition == WindowOpenDisposition::CURRENT_TAB) 129 (disposition == WindowOpenDisposition::CURRENT_TAB)
124 ? WindowOpenDisposition::NEW_FOREGROUND_TAB 130 ? WindowOpenDisposition::NEW_FOREGROUND_TAB
125 : disposition, 131 : disposition,
126 ui::PAGE_TRANSITION_LINK, false)); 132 ui::PAGE_TRANSITION_LINK, false));
127 } 133 }
OLDNEW
« no previous file with comments | « no previous file | components/infobars/core/infobar_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698