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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 1119963004: Extend the enterprise policy for SSL overrides to the "danger" command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove parens Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_blocking_page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_enumerator.h" 13 #include "base/files/file_enumerator.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/files/scoped_temp_dir.h" 16 #include "base/files/scoped_temp_dir.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/strings/string16.h" 21 #include "base/strings/string16.h"
22 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
23 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
24 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
25 #include "base/test/test_file_util.h" 26 #include "base/test/test_file_util.h"
26 #include "base/threading/sequenced_worker_pool.h" 27 #include "base/threading/sequenced_worker_pool.h"
27 #include "base/time/time.h" 28 #include "base/time/time.h"
28 #include "base/values.h" 29 #include "base/values.h"
29 #include "chrome/app/chrome_command_ids.h" 30 #include "chrome/app/chrome_command_ids.h"
30 #include "chrome/browser/autocomplete/autocomplete_controller.h" 31 #include "chrome/browser/autocomplete/autocomplete_controller.h"
31 #include "chrome/browser/background/background_contents_service.h" 32 #include "chrome/browser/background/background_contents_service.h"
(...skipping 23 matching lines...) Expand all
55 #include "chrome/browser/plugins/plugin_prefs.h" 56 #include "chrome/browser/plugins/plugin_prefs.h"
56 #include "chrome/browser/policy/cloud/test_request_interceptor.h" 57 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
57 #include "chrome/browser/policy/profile_policy_connector.h" 58 #include "chrome/browser/policy/profile_policy_connector.h"
58 #include "chrome/browser/policy/profile_policy_connector_factory.h" 59 #include "chrome/browser/policy/profile_policy_connector_factory.h"
59 #include "chrome/browser/prefs/session_startup_pref.h" 60 #include "chrome/browser/prefs/session_startup_pref.h"
60 #include "chrome/browser/profiles/profile.h" 61 #include "chrome/browser/profiles/profile.h"
61 #include "chrome/browser/search/instant_service.h" 62 #include "chrome/browser/search/instant_service.h"
62 #include "chrome/browser/search/instant_service_factory.h" 63 #include "chrome/browser/search/instant_service_factory.h"
63 #include "chrome/browser/search/search.h" 64 #include "chrome/browser/search/search.h"
64 #include "chrome/browser/search_engines/template_url_service_factory.h" 65 #include "chrome/browser/search_engines/template_url_service_factory.h"
66 #include "chrome/browser/ssl/ssl_blocking_page.h"
65 #include "chrome/browser/translate/chrome_translate_client.h" 67 #include "chrome/browser/translate/chrome_translate_client.h"
66 #include "chrome/browser/translate/cld_data_harness.h" 68 #include "chrome/browser/translate/cld_data_harness.h"
67 #include "chrome/browser/translate/cld_data_harness_factory.h" 69 #include "chrome/browser/translate/cld_data_harness_factory.h"
68 #include "chrome/browser/translate/translate_service.h" 70 #include "chrome/browser/translate/translate_service.h"
69 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" 71 #include "chrome/browser/ui/bookmarks/bookmark_bar.h"
70 #include "chrome/browser/ui/browser.h" 72 #include "chrome/browser/ui/browser.h"
71 #include "chrome/browser/ui/browser_commands.h" 73 #include "chrome/browser/ui/browser_commands.h"
72 #include "chrome/browser/ui/browser_list.h" 74 #include "chrome/browser/ui/browser_list.h"
73 #include "chrome/browser/ui/browser_tabstrip.h" 75 #include "chrome/browser/ui/browser_tabstrip.h"
74 #include "chrome/browser/ui/browser_window.h" 76 #include "chrome/browser/ui/browser_window.h"
(...skipping 3570 matching lines...) Expand 10 before | Expand all | Expand 10 after
3645 browser()->tab_strip_model()->GetActiveWebContents()); 3647 browser()->tab_strip_model()->GetActiveWebContents());
3646 ASSERT_TRUE(interstitial); 3648 ASSERT_TRUE(interstitial);
3647 EXPECT_TRUE(content::WaitForRenderFrameReady(interstitial->GetMainFrame())); 3649 EXPECT_TRUE(content::WaitForRenderFrameReady(interstitial->GetMainFrame()));
3648 3650
3649 // The interstitial should display the proceed link. 3651 // The interstitial should display the proceed link.
3650 EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText( 3652 EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText(
3651 interstitial, "proceed-link")); 3653 interstitial, "proceed-link"));
3652 } 3654 }
3653 3655
3654 // Test that when SSL error overriding is disallowed by policy, the 3656 // Test that when SSL error overriding is disallowed by policy, the
3655 // proceed link does not appear on SSL blocking pages. 3657 // proceed link does not appear on SSL blocking pages and users should not
3658 // be able to proceed.
3656 IN_PROC_BROWSER_TEST_F(PolicyTest, SSLErrorOverridingDisallowed) { 3659 IN_PROC_BROWSER_TEST_F(PolicyTest, SSLErrorOverridingDisallowed) {
3657 net::SpawnedTestServer https_server_expired( 3660 net::SpawnedTestServer https_server_expired(
3658 net::SpawnedTestServer::TYPE_HTTPS, 3661 net::SpawnedTestServer::TYPE_HTTPS,
3659 net::SpawnedTestServer::SSLOptions( 3662 net::SpawnedTestServer::SSLOptions(
3660 net::SpawnedTestServer::SSLOptions::CERT_EXPIRED), 3663 net::SpawnedTestServer::SSLOptions::CERT_EXPIRED),
3661 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 3664 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
3662 ASSERT_TRUE(https_server_expired.Start()); 3665 ASSERT_TRUE(https_server_expired.Start());
3663 3666
3664 const PrefService* const prefs = browser()->profile()->GetPrefs(); 3667 const PrefService* const prefs = browser()->profile()->GetPrefs();
3665 EXPECT_TRUE(prefs->GetBoolean(prefs::kSSLErrorOverrideAllowed)); 3668 EXPECT_TRUE(prefs->GetBoolean(prefs::kSSLErrorOverrideAllowed));
(...skipping 12 matching lines...) Expand all
3678 ui_test_utils::NavigateToURL(browser(), https_server_expired.GetURL("/")); 3681 ui_test_utils::NavigateToURL(browser(), https_server_expired.GetURL("/"));
3679 const content::InterstitialPage* const interstitial = 3682 const content::InterstitialPage* const interstitial =
3680 content::InterstitialPage::GetInterstitialPage( 3683 content::InterstitialPage::GetInterstitialPage(
3681 browser()->tab_strip_model()->GetActiveWebContents()); 3684 browser()->tab_strip_model()->GetActiveWebContents());
3682 ASSERT_TRUE(interstitial); 3685 ASSERT_TRUE(interstitial);
3683 EXPECT_TRUE(content::WaitForRenderFrameReady(interstitial->GetMainFrame())); 3686 EXPECT_TRUE(content::WaitForRenderFrameReady(interstitial->GetMainFrame()));
3684 3687
3685 // The interstitial should not display the proceed link. 3688 // The interstitial should not display the proceed link.
3686 EXPECT_FALSE(chrome_browser_interstitials::IsInterstitialDisplayingText( 3689 EXPECT_FALSE(chrome_browser_interstitials::IsInterstitialDisplayingText(
3687 interstitial, "proceed-link")); 3690 interstitial, "proceed-link"));
3691
3692 // The interstitial should not proceed, even if the command is sent in
3693 // some other way (e.g., via the keyboard shortcut).
3694 content::InterstitialPageDelegate* interstitial_delegate =
3695 content::InterstitialPage::GetInterstitialPage(
3696 browser()->tab_strip_model()->GetActiveWebContents())
3697 ->GetDelegateForTesting();
3698 ASSERT_EQ(SSLBlockingPage::kTypeForTesting,
3699 interstitial_delegate->GetTypeForTesting());
3700 SSLBlockingPage* ssl_delegate =
3701 static_cast<SSLBlockingPage*>(interstitial_delegate);
3702 ssl_delegate->CommandReceived(
3703 base::IntToString(SecurityInterstitialPage::CMD_PROCEED));
3704 EXPECT_TRUE(interstitial);
3705 EXPECT_TRUE(browser()
3706 ->tab_strip_model()
3707 ->GetActiveWebContents()
3708 ->ShowingInterstitialPage());
3688 } 3709 }
3689 3710
3690 #if !defined(OS_CHROMEOS) 3711 #if !defined(OS_CHROMEOS)
3691 // Similar to PolicyTest but sets the proper policy before the browser is 3712 // Similar to PolicyTest but sets the proper policy before the browser is
3692 // started. 3713 // started.
3693 class PolicyVariationsServiceTest : public PolicyTest { 3714 class PolicyVariationsServiceTest : public PolicyTest {
3694 public: 3715 public:
3695 void SetUpInProcessBrowserTestFixture() override { 3716 void SetUpInProcessBrowserTestFixture() override {
3696 PolicyTest::SetUpInProcessBrowserTestFixture(); 3717 PolicyTest::SetUpInProcessBrowserTestFixture();
3697 PolicyMap policies; 3718 PolicyMap policies;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3763 PrefService* prefs = browser()->profile()->GetPrefs(); 3784 PrefService* prefs = browser()->profile()->GetPrefs();
3764 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( 3785 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed(
3765 prefs, "host.name")); 3786 prefs, "host.name"));
3766 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( 3787 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed(
3767 prefs, "other.host.name")); 3788 prefs, "other.host.name"));
3768 } 3789 }
3769 3790
3770 #endif // !defined(CHROME_OS) 3791 #endif // !defined(CHROME_OS)
3771 3792
3772 } // namespace policy 3793 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_blocking_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698