| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 591 |
| 592 ActOnInterstitialAndInfobar(tab, INTERSTITIAL_PROCEED, INFOBAR_ACCEPT); | 592 ActOnInterstitialAndInfobar(tab, INTERSTITIAL_PROCEED, INFOBAR_ACCEPT); |
| 593 | 593 |
| 594 EXPECT_EQ(ManagedUserService::MANUAL_NONE, | 594 EXPECT_EQ(ManagedUserService::MANUAL_NONE, |
| 595 managed_user_service_->GetManualBehaviorForHost("www.example.com")); | 595 managed_user_service_->GetManualBehaviorForHost("www.example.com")); |
| 596 EXPECT_EQ(ManagedUserService::MANUAL_ALLOW, | 596 EXPECT_EQ(ManagedUserService::MANUAL_ALLOW, |
| 597 managed_user_service_->GetManualBehaviorForHost( | 597 managed_user_service_->GetManualBehaviorForHost( |
| 598 "www.new-example.com")); | 598 "www.new-example.com")); |
| 599 } | 599 } |
| 600 | 600 |
| 601 #if !defined(OS_CHROMEOS) |
| 601 // Now check that the passphrase dialog is shown when a passphrase is specified | 602 // Now check that the passphrase dialog is shown when a passphrase is specified |
| 602 // and the user clicks on the preview button. | 603 // and the user clicks on the preview button. |
| 603 IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest, | 604 IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest, |
| 604 PreviewAuthenticationRequired) { | 605 PreviewAuthenticationRequired) { |
| 605 // Set a passphrase. | 606 // Set a passphrase. |
| 606 PrefService* pref_service = browser()->profile()->GetPrefs(); | 607 PrefService* pref_service = browser()->profile()->GetPrefs(); |
| 607 pref_service->SetString(prefs::kManagedModeLocalPassphrase, "test"); | 608 pref_service->SetString(prefs::kManagedModeLocalPassphrase, "test"); |
| 608 | 609 |
| 609 // Navigate to an URL which should be blocked. | 610 // Navigate to an URL which should be blocked. |
| 610 GURL test_url("http://www.example.com/files/simple.html"); | 611 GURL test_url("http://www.example.com/files/simple.html"); |
| 611 ui_test_utils::NavigateToURL(browser(), test_url); | 612 ui_test_utils::NavigateToURL(browser(), test_url); |
| 612 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 613 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 613 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 614 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
| 614 | 615 |
| 615 // Get the ManagedModeInterstitial delegate. | 616 // Get the ManagedModeInterstitial delegate. |
| 616 content::InterstitialPageDelegate* delegate = | 617 content::InterstitialPageDelegate* delegate = |
| 617 interstitial_page->GetDelegateForTesting(); | 618 interstitial_page->GetDelegateForTesting(); |
| 618 | 619 |
| 619 // Simulate the click on the "preview" button. | 620 // Simulate the click on the "preview" button. |
| 620 delegate->CommandReceived("\"preview\""); | 621 delegate->CommandReceived("\"preview\""); |
| 621 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 622 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 622 WebContentsModalDialogManager::FromWebContents(tab); | 623 WebContentsModalDialogManager::FromWebContents(tab); |
| 623 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); | 624 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); |
| 624 } | 625 } |
| 625 | 626 |
| 627 #endif // OS_CHROMEOS |
| 628 |
| 626 } // namespace | 629 } // namespace |
| OLD | NEW |