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

Unified Diff: chrome/browser/translate/translate_manager_render_view_host_unittest.cc

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/translate_manager_render_view_host_unittest.cc
diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
index 507fefe7a03be152308a7bb1f9e4f5b3cf28f603..c20fdfcf53b167b3b5aba37536c56a1031233531 100644
--- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
+++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/infobars/infobar.h"
+#include "chrome/browser/infobars/infobar_manager.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
@@ -150,9 +151,9 @@ class TranslateManagerRenderViewHostTest
// Returns the translate infobar if there is 1 infobar and it is a translate
// infobar.
TranslateInfoBarDelegate* GetTranslateInfoBar() {
- return (infobar_service()->infobar_count() == 1)
- ? infobar_service()
- ->infobar_at(0)
+ InfoBarManager& infobar_manager = infobar_service()->infobar_manager();
+ return (infobar_manager.infobar_count() == 1)
+ ? infobar_manager.infobar_at(0)
->delegate()
->AsTranslateInfoBarDelegate()
: NULL;
@@ -165,7 +166,8 @@ class TranslateManagerRenderViewHostTest
if (!infobar)
return false;
infobar->InfoBarDismissed(); // Simulates closing the infobar.
- infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
+ InfoBarManager& infobar_manager = infobar_service()->infobar_manager();
+ infobar_manager.RemoveInfoBar(infobar_manager.infobar_at(0));
return true;
}
@@ -189,7 +191,8 @@ class TranslateManagerRenderViewHostTest
if (!infobar)
return false;
infobar->TranslationDeclined();
- infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
+ InfoBarManager& infobar_manager = infobar_service()->infobar_manager();
+ infobar_manager.RemoveInfoBar(infobar_manager.infobar_at(0));
return true;
}
@@ -730,21 +733,22 @@ TEST_F(TranslateManagerRenderViewHostTest, AutoTranslateOnNavigate) {
// Tests that multiple OnPageContents do not cause multiple infobars.
TEST_F(TranslateManagerRenderViewHostTest, MultipleOnPageContents) {
SimulateNavigation(GURL("http://www.google.fr"), "fr", true);
+ InfoBarManager& infobar_manager = infobar_service()->infobar_manager();
// Simulate clicking 'Nope' (don't translate).
EXPECT_TRUE(DenyTranslation());
- EXPECT_EQ(0U, infobar_service()->infobar_count());
+ EXPECT_EQ(0U, infobar_manager.infobar_count());
// Send a new PageContents, we should not show an infobar.
SimulateOnTranslateLanguageDetermined("fr", true);
- EXPECT_EQ(0U, infobar_service()->infobar_count());
+ EXPECT_EQ(0U, infobar_manager.infobar_count());
// Do the same steps but simulate closing the infobar this time.
SimulateNavigation(GURL("http://www.youtube.fr"), "fr", true);
EXPECT_TRUE(CloseTranslateInfoBar());
- EXPECT_EQ(0U, infobar_service()->infobar_count());
+ EXPECT_EQ(0U, infobar_manager.infobar_count());
SimulateOnTranslateLanguageDetermined("fr", true);
- EXPECT_EQ(0U, infobar_service()->infobar_count());
+ EXPECT_EQ(0U, infobar_manager.infobar_count());
}
// Test that reloading the page brings back the infobar if the
« no previous file with comments | « chrome/browser/translate/translate_infobar_delegate.cc ('k') | chrome/browser/ui/auto_login_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698