#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
};
SupervisedUserBlockModeTest() : supervised_user_service_(NULL) {}
- virtual ~SupervisedUserBlockModeTest() {}
+ ~SupervisedUserBlockModeTest() override {}
void CheckShownPageIsInterstitial(WebContents* tab) {
CheckShownPage(tab, content::PAGE_TYPE_INTERSTITIAL);
}
protected:
- virtual void SetUpOnMainThread() OVERRIDE {
+ void SetUpOnMainThread() override {
// Set up the SupervisedUserNavigationObserver manually since the profile
// was not supervised when the browser was created.
content::WebContents* web_contents =
new base::FundamentalValue(SupervisedUserURLFilter::BLOCK)));
}
- virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ void SetUpCommandLine(CommandLine* command_line) override {
// Enable the test server and remap all URLs to it.
ASSERT_TRUE(test_server()->Start());
std::string host_port = test_server()->host_port_pair().ToString();
HistoryVisitRecorded) {
GURL allowed_url("http://www.example.com/files/simple.html");
+ scoped_refptr<SupervisedUserURLFilter> filter =
+ supervised_user_service_->GetURLFilterForUIThread();
+
// Set the host as allowed.
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetBooleanWithoutPathExpansion(allowed_url.host(), true);
SupervisedUserSettingsServiceFactory::GetForProfile(
browser()->profile());
supervised_user_settings_service->SetLocalSettingForTesting(
- supervised_users::kContentPackManualBehaviorHosts,
- dict.PassAs<base::Value>());
- EXPECT_EQ(
- SupervisedUserService::MANUAL_ALLOW,
- supervised_user_service_->GetManualBehaviorForHost(allowed_url.host()));
+ supervised_users::kContentPackManualBehaviorHosts, dict.Pass());
+ EXPECT_EQ(SupervisedUserURLFilter::ALLOW,
+ filter->GetFilteringBehaviorForURL(allowed_url));
+ EXPECT_EQ(SupervisedUserURLFilter::ALLOW,
+ filter->GetFilteringBehaviorForURL(allowed_url.GetWithEmptyPath()));
ui_test_utils::NavigateToURL(browser(), allowed_url);
// 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(SupervisedUserService::MANUAL_ALLOW,
- supervised_user_service_->GetManualBehaviorForHost(
- "www.example.com"));
- EXPECT_EQ(
- SupervisedUserService::MANUAL_NONE,
- supervised_user_service_->GetManualBehaviorForHost(
- "www.new-example.com"));
+ EXPECT_EQ(SupervisedUserURLFilter::ALLOW,
+ filter->GetFilteringBehaviorForURL(allowed_url.GetWithEmptyPath()));
+ EXPECT_EQ(SupervisedUserURLFilter::BLOCK,
+ filter->GetFilteringBehaviorForURL(blocked_url.GetWithEmptyPath()));
// Query the history entry.
HistoryService* history_service = HistoryServiceFactory::GetForProfile(
SupervisedUserSettingsServiceFactory::GetForProfile(
browser()->profile());
supervised_user_settings_service->SetLocalSettingForTesting(
- supervised_users::kContentPackManualBehaviorHosts,
- dict.PassAs<base::Value>());
- EXPECT_EQ(
- SupervisedUserService::MANUAL_ALLOW,
- supervised_user_service_->GetManualBehaviorForHost(test_url.host()));
+ supervised_users::kContentPackManualBehaviorHosts, dict.Pass());
+
+ scoped_refptr<SupervisedUserURLFilter> filter =
+ supervised_user_service_->GetURLFilterForUIThread();
+ EXPECT_EQ(SupervisedUserURLFilter::ALLOW,
+ filter->GetFilteringBehaviorForURL(test_url.GetWithEmptyPath()));
observer.Wait();
EXPECT_EQ(test_url, web_contents->GetURL());