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

Unified Diff: chrome/browser/policy/policy_browsertest.cc

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes 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/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index 9c3ee31099027b08c262ef786491f384c761bec1..57f65a651e5f10044964f40f53ce4c2206ffa85f 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -41,6 +41,7 @@
#include "chrome/browser/extensions/updater/extension_cache_fake.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/infobars/infobar.h"
+#include "chrome/browser/infobars/infobar_manager.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/media_stream_devices_controller.h"
@@ -1339,15 +1340,17 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) {
ASSERT_TRUE(contents);
InfoBarService* infobar_service = InfoBarService::FromWebContents(contents);
ASSERT_TRUE(infobar_service);
- EXPECT_EQ(0u, infobar_service->infobar_count());
+ EXPECT_EQ(0u, infobar_service->infobar_manager().infobar_count());
base::FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html"));
GURL url(URLRequestMockHTTPJob::GetMockUrl(path));
ui_test_utils::NavigateToURL(browser(), url);
// This should have triggered the dangerous plugin infobar.
- ASSERT_EQ(1u, infobar_service->infobar_count());
- EXPECT_TRUE(
- infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate());
+ ASSERT_EQ(1u, infobar_service->infobar_manager().infobar_count());
+ EXPECT_TRUE(infobar_service->infobar_manager()
+ .infobar_at(0)
+ ->delegate()
+ ->AsConfirmInfoBarDelegate());
// And the plugin isn't running.
EXPECT_EQ(0, CountPlugins());
@@ -1358,7 +1361,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) {
UpdateProviderPolicy(policies);
// Reloading the page shouldn't trigger the infobar this time.
ui_test_utils::NavigateToURL(browser(), url);
- EXPECT_EQ(0u, infobar_service->infobar_count());
+ EXPECT_EQ(0u, infobar_service->infobar_manager().infobar_count());
// And the plugin started automatically.
EXPECT_EQ(1, CountPlugins());
}
@@ -1881,7 +1884,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
ASSERT_TRUE(contents);
InfoBarService* infobar_service = InfoBarService::FromWebContents(contents);
ASSERT_TRUE(infobar_service);
- EXPECT_EQ(0u, infobar_service->infobar_count());
+ InfoBarManager& infobar_manager = infobar_service->infobar_manager();
+ EXPECT_EQ(0u, infobar_manager.infobar_count());
// Force enable the translate feature.
PolicyMap policies;
@@ -1914,8 +1918,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
EXPECT_FALSE(language_state.IsPageTranslated());
// Verify that the translate infobar showed up.
- ASSERT_EQ(1u, infobar_service->infobar_count());
- InfoBar* infobar = infobar_service->infobar_at(0);
+ ASSERT_EQ(1u, infobar_manager.infobar_count());
+ InfoBar* infobar = infobar_manager.infobar_at(0);
TranslateInfoBarDelegate* translate_infobar_delegate =
infobar->delegate()->AsTranslateInfoBarDelegate();
ASSERT_TRUE(translate_infobar_delegate);
@@ -1924,8 +1928,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
EXPECT_EQ("fr", translate_infobar_delegate->original_language_code());
// Now force disable translate.
- infobar_service->RemoveInfoBar(infobar);
- EXPECT_EQ(0u, infobar_service->infobar_count());
+ infobar_manager.RemoveInfoBar(infobar);
+ EXPECT_EQ(0u, infobar_manager.infobar_count());
policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false), NULL);
UpdateProviderPolicy(policies);
@@ -1935,7 +1939,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
content::NotificationService::AllSources());
ui_test_utils::NavigateToURL(browser(), url);
language_observer2.Wait();
- EXPECT_EQ(0u, infobar_service->infobar_count());
+ EXPECT_EQ(0u, infobar_manager.infobar_count());
}
IN_PROC_BROWSER_TEST_F(PolicyTest, URLBlacklist) {

Powered by Google App Engine
This is Rietveld 408576698