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

Side by Side Diff: trunk/src/chrome/browser/policy/policy_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/chrome_notification_types.h" 32 #include "chrome/browser/chrome_notification_types.h"
33 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 33 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
34 #include "chrome/browser/devtools/devtools_window.h" 34 #include "chrome/browser/devtools/devtools_window.h"
35 #include "chrome/browser/download/download_prefs.h" 35 #include "chrome/browser/download/download_prefs.h"
36 #include "chrome/browser/extensions/crx_installer.h" 36 #include "chrome/browser/extensions/crx_installer.h"
37 #include "chrome/browser/extensions/extension_host.h" 37 #include "chrome/browser/extensions/extension_host.h"
38 #include "chrome/browser/extensions/extension_service.h" 38 #include "chrome/browser/extensions/extension_service.h"
39 #include "chrome/browser/extensions/extension_system.h" 39 #include "chrome/browser/extensions/extension_system.h"
40 #include "chrome/browser/extensions/unpacked_installer.h" 40 #include "chrome/browser/extensions/unpacked_installer.h"
41 #include "chrome/browser/extensions/updater/extension_updater.h" 41 #include "chrome/browser/extensions/updater/extension_updater.h"
42 #include "chrome/browser/infobars/infobar.h"
43 #include "chrome/browser/infobars/infobar_service.h" 42 #include "chrome/browser/infobars/infobar_service.h"
44 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 43 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
45 #include "chrome/browser/media/media_stream_devices_controller.h" 44 #include "chrome/browser/media/media_stream_devices_controller.h"
46 #include "chrome/browser/metrics/variations/variations_service.h" 45 #include "chrome/browser/metrics/variations/variations_service.h"
47 #include "chrome/browser/net/url_request_mock_util.h" 46 #include "chrome/browser/net/url_request_mock_util.h"
48 #include "chrome/browser/plugins/plugin_prefs.h" 47 #include "chrome/browser/plugins/plugin_prefs.h"
49 #include "chrome/browser/policy/browser_policy_connector.h" 48 #include "chrome/browser/policy/browser_policy_connector.h"
50 #include "chrome/browser/policy/cloud/test_request_interceptor.h" 49 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
51 #include "chrome/browser/policy/mock_configuration_policy_provider.h" 50 #include "chrome/browser/policy/mock_configuration_policy_provider.h"
52 #include "chrome/browser/policy/policy_service.h" 51 #include "chrome/browser/policy/policy_service.h"
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 ASSERT_TRUE(contents); 1306 ASSERT_TRUE(contents);
1308 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents); 1307 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents);
1309 ASSERT_TRUE(infobar_service); 1308 ASSERT_TRUE(infobar_service);
1310 EXPECT_EQ(0u, infobar_service->infobar_count()); 1309 EXPECT_EQ(0u, infobar_service->infobar_count());
1311 1310
1312 base::FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html")); 1311 base::FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html"));
1313 GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); 1312 GURL url(URLRequestMockHTTPJob::GetMockUrl(path));
1314 ui_test_utils::NavigateToURL(browser(), url); 1313 ui_test_utils::NavigateToURL(browser(), url);
1315 // This should have triggered the dangerous plugin infobar. 1314 // This should have triggered the dangerous plugin infobar.
1316 ASSERT_EQ(1u, infobar_service->infobar_count()); 1315 ASSERT_EQ(1u, infobar_service->infobar_count());
1317 EXPECT_TRUE( 1316 EXPECT_TRUE(infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate());
1318 infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate());
1319 // And the plugin isn't running. 1317 // And the plugin isn't running.
1320 EXPECT_EQ(0, CountPlugins()); 1318 EXPECT_EQ(0, CountPlugins());
1321 1319
1322 // Now set a policy to always authorize this. 1320 // Now set a policy to always authorize this.
1323 PolicyMap policies; 1321 PolicyMap policies;
1324 policies.Set(key::kAlwaysAuthorizePlugins, POLICY_LEVEL_MANDATORY, 1322 policies.Set(key::kAlwaysAuthorizePlugins, POLICY_LEVEL_MANDATORY,
1325 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); 1323 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL);
1326 UpdateProviderPolicy(policies); 1324 UpdateProviderPolicy(policies);
1327 // Reloading the page shouldn't trigger the infobar this time. 1325 // Reloading the page shouldn't trigger the infobar this time.
1328 ui_test_utils::NavigateToURL(browser(), url); 1326 ui_test_utils::NavigateToURL(browser(), url);
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 ASSERT_TRUE(translate_tab_helper); 1869 ASSERT_TRUE(translate_tab_helper);
1872 LanguageState& language_state = translate_tab_helper->language_state(); 1870 LanguageState& language_state = translate_tab_helper->language_state();
1873 EXPECT_EQ("fr", language_state.original_language()); 1871 EXPECT_EQ("fr", language_state.original_language());
1874 EXPECT_TRUE(language_state.page_needs_translation()); 1872 EXPECT_TRUE(language_state.page_needs_translation());
1875 EXPECT_FALSE(language_state.translation_pending()); 1873 EXPECT_FALSE(language_state.translation_pending());
1876 EXPECT_FALSE(language_state.translation_declined()); 1874 EXPECT_FALSE(language_state.translation_declined());
1877 EXPECT_FALSE(language_state.IsPageTranslated()); 1875 EXPECT_FALSE(language_state.IsPageTranslated());
1878 1876
1879 // Verify that the translate infobar showed up. 1877 // Verify that the translate infobar showed up.
1880 ASSERT_EQ(1u, infobar_service->infobar_count()); 1878 ASSERT_EQ(1u, infobar_service->infobar_count());
1881 InfoBar* infobar = infobar_service->infobar_at(0); 1879 InfoBarDelegate* infobar = infobar_service->infobar_at(0);
1882 TranslateInfoBarDelegate* translate_infobar_delegate = 1880 TranslateInfoBarDelegate* translate_infobar_delegate =
1883 infobar->delegate()->AsTranslateInfoBarDelegate(); 1881 infobar->AsTranslateInfoBarDelegate();
1884 ASSERT_TRUE(translate_infobar_delegate); 1882 ASSERT_TRUE(translate_infobar_delegate);
1885 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, 1883 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE,
1886 translate_infobar_delegate->infobar_type()); 1884 translate_infobar_delegate->infobar_type());
1887 EXPECT_EQ("fr", translate_infobar_delegate->original_language_code()); 1885 EXPECT_EQ("fr", translate_infobar_delegate->original_language_code());
1888 1886
1889 // Now force disable translate. 1887 // Now force disable translate.
1890 infobar_service->RemoveInfoBar(infobar); 1888 infobar_service->RemoveInfoBar(infobar);
1891 EXPECT_EQ(0u, infobar_service->infobar_count()); 1889 EXPECT_EQ(0u, infobar_service->infobar_count());
1892 policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY, 1890 policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY,
1893 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false), NULL); 1891 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false), NULL);
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
2863 chrome_variations::VariationsService::GetVariationsServerURL( 2861 chrome_variations::VariationsService::GetVariationsServerURL(
2864 g_browser_process->local_state()); 2862 g_browser_process->local_state());
2865 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); 2863 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true));
2866 std::string value; 2864 std::string value;
2867 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); 2865 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
2868 EXPECT_EQ("restricted", value); 2866 EXPECT_EQ("restricted", value);
2869 } 2867 }
2870 #endif 2868 #endif
2871 2869
2872 } // namespace policy 2870 } // namespace policy
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/plugins/plugin_infobar_delegates.cc ('k') | trunk/src/chrome/browser/ssl/ssl_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698