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

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

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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"
11 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/translate/translate_infobar_delegate.h" 11 #include "chrome/browser/translate/translate_infobar_delegate.h"
13 #include "chrome/browser/translate/translate_script.h" 12 #include "chrome/browser/translate/translate_script.h"
14 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/test_switches.h" 16 #include "chrome/test/base/test_switches.h"
18 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
19 #include "components/translate/common/translate_switches.h" 18 #include "components/translate/common/translate_switches.h"
20 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 ADD_FAILURE() << "infobar service is not available"; 83 ADD_FAILURE() << "infobar service is not available";
85 return NULL; 84 return NULL;
86 } 85 }
87 86
88 TranslateInfoBarDelegate* delegate = NULL; 87 TranslateInfoBarDelegate* delegate = NULL;
89 for (size_t i = 0; i < infobar_service_->infobar_count(); ++i) { 88 for (size_t i = 0; i < infobar_service_->infobar_count(); ++i) {
90 // Check if the shown infobar is a confirm infobar coming from the 89 // Check if the shown infobar is a confirm infobar coming from the
91 // |kTranslateSecurityOrigin| flag specified in SetUpCommandLine(). 90 // |kTranslateSecurityOrigin| flag specified in SetUpCommandLine().
92 // This infobar appears in all tests of TranslateBrowserTest and can be 91 // This infobar appears in all tests of TranslateBrowserTest and can be
93 // ignored here. 92 // ignored here.
94 ConfirmInfoBarDelegate* confirm = infobar_service_->infobar_at(i)-> 93 ConfirmInfoBarDelegate* confirm =
95 delegate()->AsConfirmInfoBarDelegate(); 94 infobar_service_->infobar_at(i)->AsConfirmInfoBarDelegate();
96 if (confirm) 95 if (confirm)
97 continue; 96 continue;
98 97
99 TranslateInfoBarDelegate* translate = infobar_service_->infobar_at(i)-> 98 TranslateInfoBarDelegate* translate =
100 delegate()->AsTranslateInfoBarDelegate(); 99 infobar_service_->infobar_at(i)->AsTranslateInfoBarDelegate();
101 if (translate) { 100 if (translate) {
102 EXPECT_FALSE(delegate) << "multiple infobars are shown unexpectedly"; 101 EXPECT_FALSE(delegate) << "multiple infobars are shown unexpectedly";
103 delegate = translate; 102 delegate = translate;
104 continue; 103 continue;
105 } 104 }
106 105
107 // Other infobar should not be shown. 106 // Other infobar should not be shown.
108 EXPECT_TRUE(delegate); 107 EXPECT_TRUE(delegate);
109 } 108 }
110 return delegate; 109 return delegate;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 GetNonSecureURL(kUpdateLocationAtOnloadTestPath)); 350 GetNonSecureURL(kUpdateLocationAtOnloadTestPath));
352 351
353 // Wait for the page title is changed after the test finished. 352 // Wait for the page title is changed after the test finished.
354 const string16 result = watcher.WaitAndGetTitle(); 353 const string16 result = watcher.WaitAndGetTitle();
355 EXPECT_EQ("PASS", UTF16ToASCII(result)); 354 EXPECT_EQ("PASS", UTF16ToASCII(result));
356 355
357 // Check if there is no Translate infobar. 356 // Check if there is no Translate infobar.
358 translate = GetExistingTranslateInfoBarDelegate(); 357 translate = GetExistingTranslateInfoBarDelegate();
359 EXPECT_FALSE(translate); 358 EXPECT_FALSE(translate);
360 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698