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

Unified Diff: chrome/browser/supervised_user/supervised_user_browsertest.cc

Issue 335833003: Rename "managed (mode|user)" to "supervised user" (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments (+ a few other cleanups) Created 6 years, 6 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/supervised_user/supervised_user_browsertest.cc
diff --git a/chrome/browser/managed_mode/managed_mode_browsertest.cc b/chrome/browser/supervised_user/supervised_user_browsertest.cc
similarity index 77%
rename from chrome/browser/managed_mode/managed_mode_browsertest.cc
rename to chrome/browser/supervised_user/supervised_user_browsertest.cc
index 9af827ec2096025a01c39f6df1d3d5f6ec99473e..fbe5d5a741f41ef3b3d6dc5e53419de259744450 100644
--- a/chrome/browser/managed_mode/managed_mode_browsertest.cc
+++ b/chrome/browser/supervised_user/supervised_user_browsertest.cc
@@ -10,14 +10,14 @@
#include "chrome/browser/common/cancelable_request.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/managed_mode/managed_mode_interstitial.h"
-#include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
-#include "chrome/browser/managed_mode/managed_user_constants.h"
-#include "chrome/browser/managed_mode/managed_user_service.h"
-#include "chrome/browser/managed_mode/managed_user_service_factory.h"
-#include "chrome/browser/managed_mode/managed_user_settings_service.h"
-#include "chrome/browser/managed_mode/managed_user_settings_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/supervised_user/supervised_user_constants.h"
+#include "chrome/browser/supervised_user/supervised_user_interstitial.h"
+#include "chrome/browser/supervised_user/supervised_user_navigation_observer.h"
+#include "chrome/browser/supervised_user/supervised_user_service.h"
+#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
+#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -48,7 +48,7 @@ using content::WebContents;
namespace {
// Tests the filter mode in which all sites are blocked by default.
-class ManagedModeBlockModeTest : public InProcessBrowserTest {
+class SupervisedUserBlockModeTest : public InProcessBrowserTest {
public:
// Indicates whether the interstitial should proceed or not.
enum InterstitialAction {
@@ -56,8 +56,8 @@ class ManagedModeBlockModeTest : public InProcessBrowserTest {
INTERSTITIAL_DONTPROCEED,
};
- ManagedModeBlockModeTest() : managed_user_service_(NULL) {}
- virtual ~ManagedModeBlockModeTest() {}
+ SupervisedUserBlockModeTest() : supervised_user_service_(NULL) {}
+ virtual ~SupervisedUserBlockModeTest() {}
void CheckShownPageIsInterstitial(WebContents* tab) {
CheckShownPage(tab, content::PAGE_TYPE_INTERSTITIAL);
@@ -79,7 +79,7 @@ class ManagedModeBlockModeTest : public InProcessBrowserTest {
InterstitialPage* interstitial_page = tab->GetInterstitialPage();
ASSERT_TRUE(interstitial_page);
- // Get the ManagedModeInterstitial delegate.
+ // Get the SupervisedUserInterstitial delegate.
content::InterstitialPageDelegate* delegate =
interstitial_page->GetDelegateForTesting();
@@ -91,7 +91,7 @@ class ManagedModeBlockModeTest : public InProcessBrowserTest {
InterstitialPage* interstitial_page = tab->GetInterstitialPage();
ASSERT_TRUE(interstitial_page);
- // Get the ManagedModeInterstitial delegate.
+ // Get the SupervisedUserInterstitial delegate.
content::InterstitialPageDelegate* delegate =
interstitial_page->GetDelegateForTesting();
@@ -101,20 +101,21 @@ class ManagedModeBlockModeTest : public InProcessBrowserTest {
protected:
virtual void SetUpOnMainThread() OVERRIDE {
- // Set up the ManagedModeNavigationObserver manually since the profile was
- // not managed when the browser was created.
+ // Set up the SupervisedUserNavigationObserver manually since the profile
+ // was not supervised when the browser was created.
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
- ManagedModeNavigationObserver::CreateForWebContents(web_contents);
+ SupervisedUserNavigationObserver::CreateForWebContents(web_contents);
Profile* profile = browser()->profile();
- managed_user_service_ = ManagedUserServiceFactory::GetForProfile(profile);
- ManagedUserSettingsService* managed_user_settings_service =
- ManagedUserSettingsServiceFactory::GetForProfile(profile);
- managed_user_settings_service->SetLocalSettingForTesting(
- managed_users::kContentPackDefaultFilteringBehavior,
+ supervised_user_service_ =
+ SupervisedUserServiceFactory::GetForProfile(profile);
+ SupervisedUserSettingsService* supervised_user_settings_service =
+ SupervisedUserSettingsServiceFactory::GetForProfile(profile);
+ supervised_user_settings_service->SetLocalSettingForTesting(
+ supervised_users::kContentPackDefaultFilteringBehavior,
scoped_ptr<base::Value>(
- new base::FundamentalValue(ManagedModeURLFilter::BLOCK)));
+ new base::FundamentalValue(SupervisedUserURLFilter::BLOCK)));
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
@@ -141,7 +142,7 @@ class ManagedModeBlockModeTest : public InProcessBrowserTest {
base::UTF8ToUTF16(text_query),
options,
&history_request_consumer,
- base::Bind(&ManagedModeBlockModeTest::QueryHistoryComplete,
+ base::Bind(&SupervisedUserBlockModeTest::QueryHistoryComplete,
base::Unretained(this),
results,
&run_loop));
@@ -156,7 +157,7 @@ class ManagedModeBlockModeTest : public InProcessBrowserTest {
run_loop->Quit(); // Will return out to QueryHistory.
}
- ManagedUserService* managed_user_service_;
+ SupervisedUserService* supervised_user_service_;
};
class MockTabStripModelObserver : public TabStripModelObserver {
@@ -177,7 +178,7 @@ class MockTabStripModelObserver : public TabStripModelObserver {
};
// Navigates to a blocked URL.
-IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest,
+IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest,
SendAccessRequestOnBlockedURL) {
GURL test_url("http://www.example.com/files/simple.html");
ui_test_utils::NavigateToURL(browser(), test_url);
@@ -200,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest,
// Navigates to a blocked URL in a new tab. We expect the tab to be closed
// automatically on pressing the "back" button on the interstitial.
-IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest, OpenBlockedURLInNewTab) {
+IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, OpenBlockedURLInNewTab) {
TabStripModel* tab_strip = browser()->tab_strip_model();
WebContents* prev_tab = tab_strip->GetActiveWebContents();
@@ -224,22 +225,22 @@ IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest, OpenBlockedURLInNewTab) {
}
// Tests whether a visit attempt adds a special history entry.
-IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest,
+IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest,
HistoryVisitRecorded) {
GURL allowed_url("http://www.example.com/files/simple.html");
// Set the host as allowed.
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetBooleanWithoutPathExpansion(allowed_url.host(), true);
- ManagedUserSettingsService* managed_user_settings_service =
- ManagedUserSettingsServiceFactory::GetForProfile(
+ SupervisedUserSettingsService* supervised_user_settings_service =
+ SupervisedUserSettingsServiceFactory::GetForProfile(
browser()->profile());
- managed_user_settings_service->SetLocalSettingForTesting(
- managed_users::kContentPackManualBehaviorHosts,
+ supervised_user_settings_service->SetLocalSettingForTesting(
+ supervised_users::kContentPackManualBehaviorHosts,
dict.PassAs<base::Value>());
EXPECT_EQ(
- ManagedUserService::MANUAL_ALLOW,
- managed_user_service_->GetManualBehaviorForHost(allowed_url.host()));
+ SupervisedUserService::MANUAL_ALLOW,
+ supervised_user_service_->GetManualBehaviorForHost(allowed_url.host()));
ui_test_utils::NavigateToURL(browser(), allowed_url);
@@ -259,11 +260,13 @@ IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest,
// Check that we went back to the first URL and that the manual behaviors
// have not changed.
EXPECT_EQ(allowed_url.spec(), tab->GetURL().spec());
- EXPECT_EQ(ManagedUserService::MANUAL_ALLOW,
- managed_user_service_->GetManualBehaviorForHost("www.example.com"));
+ EXPECT_EQ(SupervisedUserService::MANUAL_ALLOW,
+ supervised_user_service_->GetManualBehaviorForHost(
+ "www.example.com"));
EXPECT_EQ(
- ManagedUserService::MANUAL_NONE,
- managed_user_service_->GetManualBehaviorForHost("www.new-example.com"));
+ SupervisedUserService::MANUAL_NONE,
+ supervised_user_service_->GetManualBehaviorForHost(
+ "www.new-example.com"));
// Query the history entry.
HistoryService* history_service = HistoryServiceFactory::GetForProfile(
@@ -280,7 +283,7 @@ IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest,
EXPECT_FALSE(results[1].blocked_visit());
}
-IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest, Unblock) {
+IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, Unblock) {
GURL test_url("http://www.example.com/files/simple.html");
ui_test_utils::NavigateToURL(browser(), test_url);
@@ -296,15 +299,15 @@ IN_PROC_BROWSER_TEST_F(ManagedModeBlockModeTest, Unblock) {
// Set the host as allowed.
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetBooleanWithoutPathExpansion(test_url.host(), true);
- ManagedUserSettingsService* managed_user_settings_service =
- ManagedUserSettingsServiceFactory::GetForProfile(
+ SupervisedUserSettingsService* supervised_user_settings_service =
+ SupervisedUserSettingsServiceFactory::GetForProfile(
browser()->profile());
- managed_user_settings_service->SetLocalSettingForTesting(
- managed_users::kContentPackManualBehaviorHosts,
+ supervised_user_settings_service->SetLocalSettingForTesting(
+ supervised_users::kContentPackManualBehaviorHosts,
dict.PassAs<base::Value>());
EXPECT_EQ(
- ManagedUserService::MANUAL_ALLOW,
- managed_user_service_->GetManualBehaviorForHost(test_url.host()));
+ SupervisedUserService::MANUAL_ALLOW,
+ supervised_user_service_->GetManualBehaviorForHost(test_url.host()));
observer.Wait();
EXPECT_EQ(test_url, web_contents->GetURL());

Powered by Google App Engine
This is Rietveld 408576698