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

Side by Side Diff: chrome/browser/translate/translate_browsertest.cc

Issue 228293004: InfoBarService inherits from InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 8 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 | Annotate | Revision Log
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 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/infobars/infobar.h" 10 #include "chrome/browser/infobars/infobar.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 browser()->tab_strip_model()->GetActiveWebContents(); 85 browser()->tab_strip_model()->GetActiveWebContents();
86 if (web_contents) 86 if (web_contents)
87 infobar_service_ = InfoBarService::FromWebContents(web_contents); 87 infobar_service_ = InfoBarService::FromWebContents(web_contents);
88 } 88 }
89 if (!infobar_service_) { 89 if (!infobar_service_) {
90 ADD_FAILURE() << "infobar service is not available"; 90 ADD_FAILURE() << "infobar service is not available";
91 return NULL; 91 return NULL;
92 } 92 }
93 93
94 TranslateInfoBarDelegate* delegate = NULL; 94 TranslateInfoBarDelegate* delegate = NULL;
95 InfoBarManager* infobar_manager = infobar_service_->infobar_manager(); 95 for (size_t i = 0; i < infobar_service_->infobar_count(); ++i) {
96 for (size_t i = 0; i < infobar_manager->infobar_count(); ++i) {
97 // Check if the shown infobar is a confirm infobar coming from the 96 // Check if the shown infobar is a confirm infobar coming from the
98 // |kTranslateSecurityOrigin| flag specified in SetUpCommandLine(). 97 // |kTranslateSecurityOrigin| flag specified in SetUpCommandLine().
99 // This infobar appears in all tests of TranslateBrowserTest and can be 98 // This infobar appears in all tests of TranslateBrowserTest and can be
100 // ignored here. 99 // ignored here.
101 ConfirmInfoBarDelegate* confirm = infobar_manager->infobar_at(i) 100 if (infobar_service_->infobar_at(i)->delegate()->
102 ->delegate()->AsConfirmInfoBarDelegate(); 101 AsConfirmInfoBarDelegate()) {
103 if (confirm)
104 continue; 102 continue;
103 }
105 104
106 TranslateInfoBarDelegate* translate = infobar_manager->infobar_at(i) 105 TranslateInfoBarDelegate* translate =
107 ->delegate()->AsTranslateInfoBarDelegate(); 106 infobar_service_->infobar_at(i)->delegate()->
107 AsTranslateInfoBarDelegate();
108 if (translate) { 108 if (translate) {
109 EXPECT_FALSE(delegate) << "multiple infobars are shown unexpectedly"; 109 EXPECT_FALSE(delegate) << "multiple infobars are shown unexpectedly";
110 delegate = translate; 110 delegate = translate;
111 continue; 111 continue;
112 } 112 }
113 113
114 // Other infobar should not be shown. 114 // Other infobar should not be shown.
115 EXPECT_TRUE(delegate); 115 EXPECT_TRUE(delegate);
116 } 116 }
117 return delegate; 117 return delegate;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 GetNonSecureURL(kUpdateLocationAtOnloadTestPath)); 358 GetNonSecureURL(kUpdateLocationAtOnloadTestPath));
359 359
360 // Wait for the page title is changed after the test finished. 360 // Wait for the page title is changed after the test finished.
361 const base::string16 result = watcher.WaitAndGetTitle(); 361 const base::string16 result = watcher.WaitAndGetTitle();
362 EXPECT_EQ("PASS", base::UTF16ToASCII(result)); 362 EXPECT_EQ("PASS", base::UTF16ToASCII(result));
363 363
364 // Check if there is no Translate infobar. 364 // Check if there is no Translate infobar.
365 translate = GetExistingTranslateInfoBarDelegate(); 365 translate = GetExistingTranslateInfoBarDelegate();
366 EXPECT_FALSE(translate); 366 EXPECT_FALSE(translate);
367 } 367 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/translate/translate_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698