OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/download/download_dir_policy_handler.h" | 10 #include "chrome/browser/download/download_dir_policy_handler.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 scoped_refptr<policy::ConfigurationPolicyPrefStore> recommended_store_; | 64 scoped_refptr<policy::ConfigurationPolicyPrefStore> recommended_store_; |
65 }; | 65 }; |
66 | 66 |
67 #if !defined(OS_CHROMEOS) | 67 #if !defined(OS_CHROMEOS) |
68 TEST_F(DownloadDirPolicyHandlerTest, SetDownloadDirectory) { | 68 TEST_F(DownloadDirPolicyHandlerTest, SetDownloadDirectory) { |
69 policy::PolicyMap policy; | 69 policy::PolicyMap policy; |
70 EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL)); | 70 EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL)); |
71 policy.Set(policy::key::kDownloadDirectory, | 71 policy.Set(policy::key::kDownloadDirectory, |
72 policy::POLICY_LEVEL_MANDATORY, | 72 policy::POLICY_LEVEL_MANDATORY, |
73 policy::POLICY_SCOPE_USER, | 73 policy::POLICY_SCOPE_USER, |
74 base::Value::CreateStringValue(std::string()), | 74 new base::StringValue(std::string()), |
75 NULL); | 75 NULL); |
76 UpdateProviderPolicy(policy); | 76 UpdateProviderPolicy(policy); |
77 | 77 |
78 // Setting a DownloadDirectory should disable the PromptForDownload pref. | 78 // Setting a DownloadDirectory should disable the PromptForDownload pref. |
79 const base::Value* value = NULL; | 79 const base::Value* value = NULL; |
80 EXPECT_TRUE(store_->GetValue(prefs::kPromptForDownload, &value)); | 80 EXPECT_TRUE(store_->GetValue(prefs::kPromptForDownload, &value)); |
81 ASSERT_TRUE(value); | 81 ASSERT_TRUE(value); |
82 bool prompt_for_download = true; | 82 bool prompt_for_download = true; |
83 bool result = value->GetAsBoolean(&prompt_for_download); | 83 bool result = value->GetAsBoolean(&prompt_for_download); |
84 ASSERT_TRUE(result); | 84 ASSERT_TRUE(result); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 EXPECT_FALSE(recommended_store_->GetValue(prefs::kPromptForDownload, NULL)); | 153 EXPECT_FALSE(recommended_store_->GetValue(prefs::kPromptForDownload, NULL)); |
154 EXPECT_FALSE(recommended_store_->GetValue(prefs::kDisableDrive, NULL)); | 154 EXPECT_FALSE(recommended_store_->GetValue(prefs::kDisableDrive, NULL)); |
155 | 155 |
156 EXPECT_TRUE( | 156 EXPECT_TRUE( |
157 recommended_store_->GetValue(prefs::kDownloadDefaultDirectory, &value)); | 157 recommended_store_->GetValue(prefs::kDownloadDefaultDirectory, &value)); |
158 EXPECT_TRUE(value); | 158 EXPECT_TRUE(value); |
159 EXPECT_TRUE(value->GetAsString(&download_directory)); | 159 EXPECT_TRUE(value->GetAsString(&download_directory)); |
160 EXPECT_EQ(kUserIDHash, download_directory); | 160 EXPECT_EQ(kUserIDHash, download_directory); |
161 } | 161 } |
162 #endif | 162 #endif |
OLD | NEW |