Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / download / download_dir_policy_handler_unittest.cc
blob49e6ae2531ab1b96ced126797d820fd31105e576
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/values.h"
6 #include "chrome/browser/download/download_dir_policy_handler.h"
7 #include "chrome/browser/download/download_prefs.h"
8 #include "chrome/browser/policy/configuration_policy_pref_store_test.h"
9 #include "chrome/common/pref_names.h"
10 #include "components/policy/core/browser/configuration_policy_pref_store.h"
11 #include "components/policy/core/common/policy_map.h"
12 #include "policy/policy_constants.h"
14 class DownloadDirPolicyHandlerTest
15 : public policy::ConfigurationPolicyPrefStoreTest {
16 public:
17 virtual void SetUp() OVERRIDE {
18 handler_list_.AddHandler(
19 make_scoped_ptr<policy::ConfigurationPolicyHandler>(
20 new DownloadDirPolicyHandler));
24 TEST_F(DownloadDirPolicyHandlerTest, SetDownloadDirectory) {
25 policy::PolicyMap policy;
26 EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
27 policy.Set(policy::key::kDownloadDirectory,
28 policy::POLICY_LEVEL_MANDATORY,
29 policy::POLICY_SCOPE_USER,
30 base::Value::CreateStringValue(std::string()),
31 NULL);
32 UpdateProviderPolicy(policy);
34 // Setting a DownloadDirectory should disable the PromptForDownload pref.
35 const base::Value* value = NULL;
36 EXPECT_TRUE(store_->GetValue(prefs::kPromptForDownload, &value));
37 ASSERT_TRUE(value);
38 bool prompt_for_download = true;
39 bool result = value->GetAsBoolean(&prompt_for_download);
40 ASSERT_TRUE(result);
41 EXPECT_FALSE(prompt_for_download);