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 27 matching lines...) Expand all Loading... |
38 .value(); | 38 .value(); |
39 } | 39 } |
40 | 40 |
41 #endif | 41 #endif |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 class DownloadDirPolicyHandlerTest | 45 class DownloadDirPolicyHandlerTest |
46 : public policy::ConfigurationPolicyPrefStoreTest { | 46 : public policy::ConfigurationPolicyPrefStoreTest { |
47 public: | 47 public: |
48 virtual void SetUp() OVERRIDE { | 48 virtual void SetUp() override { |
49 recommended_store_ = new policy::ConfigurationPolicyPrefStore( | 49 recommended_store_ = new policy::ConfigurationPolicyPrefStore( |
50 policy_service_.get(), | 50 policy_service_.get(), |
51 &handler_list_, | 51 &handler_list_, |
52 policy::POLICY_LEVEL_RECOMMENDED); | 52 policy::POLICY_LEVEL_RECOMMENDED); |
53 handler_list_.AddHandler( | 53 handler_list_.AddHandler( |
54 make_scoped_ptr<policy::ConfigurationPolicyHandler>( | 54 make_scoped_ptr<policy::ConfigurationPolicyHandler>( |
55 new DownloadDirPolicyHandler)); | 55 new DownloadDirPolicyHandler)); |
56 } | 56 } |
57 | 57 |
58 virtual void PopulatePolicyHandlerParameters( | 58 virtual void PopulatePolicyHandlerParameters( |
59 policy::PolicyHandlerParameters* parameters) OVERRIDE { | 59 policy::PolicyHandlerParameters* parameters) override { |
60 parameters->user_id_hash = kUserIDHash; | 60 parameters->user_id_hash = kUserIDHash; |
61 } | 61 } |
62 | 62 |
63 protected: | 63 protected: |
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; |
(...skipping 83 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 |