OLD | NEW |
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 Loading... |
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" |
42 #include "chrome/browser/infobars/infobar_service.h" | 43 #include "chrome/browser/infobars/infobar_service.h" |
43 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 44 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
44 #include "chrome/browser/media/media_stream_devices_controller.h" | 45 #include "chrome/browser/media/media_stream_devices_controller.h" |
45 #include "chrome/browser/metrics/variations/variations_service.h" | 46 #include "chrome/browser/metrics/variations/variations_service.h" |
46 #include "chrome/browser/net/url_request_mock_util.h" | 47 #include "chrome/browser/net/url_request_mock_util.h" |
47 #include "chrome/browser/plugins/plugin_prefs.h" | 48 #include "chrome/browser/plugins/plugin_prefs.h" |
48 #include "chrome/browser/policy/browser_policy_connector.h" | 49 #include "chrome/browser/policy/browser_policy_connector.h" |
49 #include "chrome/browser/policy/cloud/test_request_interceptor.h" | 50 #include "chrome/browser/policy/cloud/test_request_interceptor.h" |
50 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 51 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
51 #include "chrome/browser/policy/policy_service.h" | 52 #include "chrome/browser/policy/policy_service.h" |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 ASSERT_TRUE(contents); | 1307 ASSERT_TRUE(contents); |
1307 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents); | 1308 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents); |
1308 ASSERT_TRUE(infobar_service); | 1309 ASSERT_TRUE(infobar_service); |
1309 EXPECT_EQ(0u, infobar_service->infobar_count()); | 1310 EXPECT_EQ(0u, infobar_service->infobar_count()); |
1310 | 1311 |
1311 base::FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html")); | 1312 base::FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html")); |
1312 GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); | 1313 GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); |
1313 ui_test_utils::NavigateToURL(browser(), url); | 1314 ui_test_utils::NavigateToURL(browser(), url); |
1314 // This should have triggered the dangerous plugin infobar. | 1315 // This should have triggered the dangerous plugin infobar. |
1315 ASSERT_EQ(1u, infobar_service->infobar_count()); | 1316 ASSERT_EQ(1u, infobar_service->infobar_count()); |
1316 EXPECT_TRUE(infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate()); | 1317 EXPECT_TRUE( |
| 1318 infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate()); |
1317 // And the plugin isn't running. | 1319 // And the plugin isn't running. |
1318 EXPECT_EQ(0, CountPlugins()); | 1320 EXPECT_EQ(0, CountPlugins()); |
1319 | 1321 |
1320 // Now set a policy to always authorize this. | 1322 // Now set a policy to always authorize this. |
1321 PolicyMap policies; | 1323 PolicyMap policies; |
1322 policies.Set(key::kAlwaysAuthorizePlugins, POLICY_LEVEL_MANDATORY, | 1324 policies.Set(key::kAlwaysAuthorizePlugins, POLICY_LEVEL_MANDATORY, |
1323 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); | 1325 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); |
1324 UpdateProviderPolicy(policies); | 1326 UpdateProviderPolicy(policies); |
1325 // Reloading the page shouldn't trigger the infobar this time. | 1327 // Reloading the page shouldn't trigger the infobar this time. |
1326 ui_test_utils::NavigateToURL(browser(), url); | 1328 ui_test_utils::NavigateToURL(browser(), url); |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 ASSERT_TRUE(translate_tab_helper); | 1871 ASSERT_TRUE(translate_tab_helper); |
1870 LanguageState& language_state = translate_tab_helper->language_state(); | 1872 LanguageState& language_state = translate_tab_helper->language_state(); |
1871 EXPECT_EQ("fr", language_state.original_language()); | 1873 EXPECT_EQ("fr", language_state.original_language()); |
1872 EXPECT_TRUE(language_state.page_needs_translation()); | 1874 EXPECT_TRUE(language_state.page_needs_translation()); |
1873 EXPECT_FALSE(language_state.translation_pending()); | 1875 EXPECT_FALSE(language_state.translation_pending()); |
1874 EXPECT_FALSE(language_state.translation_declined()); | 1876 EXPECT_FALSE(language_state.translation_declined()); |
1875 EXPECT_FALSE(language_state.IsPageTranslated()); | 1877 EXPECT_FALSE(language_state.IsPageTranslated()); |
1876 | 1878 |
1877 // Verify that the translate infobar showed up. | 1879 // Verify that the translate infobar showed up. |
1878 ASSERT_EQ(1u, infobar_service->infobar_count()); | 1880 ASSERT_EQ(1u, infobar_service->infobar_count()); |
1879 InfoBarDelegate* infobar = infobar_service->infobar_at(0); | 1881 InfoBar* infobar = infobar_service->infobar_at(0); |
1880 TranslateInfoBarDelegate* translate_infobar_delegate = | 1882 TranslateInfoBarDelegate* translate_infobar_delegate = |
1881 infobar->AsTranslateInfoBarDelegate(); | 1883 infobar->delegate()->AsTranslateInfoBarDelegate(); |
1882 ASSERT_TRUE(translate_infobar_delegate); | 1884 ASSERT_TRUE(translate_infobar_delegate); |
1883 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, | 1885 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, |
1884 translate_infobar_delegate->infobar_type()); | 1886 translate_infobar_delegate->infobar_type()); |
1885 EXPECT_EQ("fr", translate_infobar_delegate->original_language_code()); | 1887 EXPECT_EQ("fr", translate_infobar_delegate->original_language_code()); |
1886 | 1888 |
1887 // Now force disable translate. | 1889 // Now force disable translate. |
1888 infobar_service->RemoveInfoBar(infobar); | 1890 infobar_service->RemoveInfoBar(infobar); |
1889 EXPECT_EQ(0u, infobar_service->infobar_count()); | 1891 EXPECT_EQ(0u, infobar_service->infobar_count()); |
1890 policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY, | 1892 policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY, |
1891 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false), NULL); | 1893 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false), NULL); |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 chrome_variations::VariationsService::GetVariationsServerURL( | 2863 chrome_variations::VariationsService::GetVariationsServerURL( |
2862 g_browser_process->local_state()); | 2864 g_browser_process->local_state()); |
2863 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2865 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
2864 std::string value; | 2866 std::string value; |
2865 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2867 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
2866 EXPECT_EQ("restricted", value); | 2868 EXPECT_EQ("restricted", value); |
2867 } | 2869 } |
2868 #endif | 2870 #endif |
2869 | 2871 |
2870 } // namespace policy | 2872 } // namespace policy |
OLD | NEW |