| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/download/download_prefs.h" | 5 #include "chrome/browser/download/download_prefs.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "chrome/common/pref_names.h" | 8 #include "chrome/common/pref_names.h" |
| 9 #include "chrome/common/safe_browsing/file_type_policies.h" | 9 #include "chrome/common/safe_browsing/file_type_policies.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( | 111 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( |
| 112 base::FilePath(FILE_PATH_LITERAL("x.txt")))); | 112 base::FilePath(FILE_PATH_LITERAL("x.txt")))); |
| 113 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( | 113 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( |
| 114 base::FilePath(FILE_PATH_LITERAL("x.TXT")))); | 114 base::FilePath(FILE_PATH_LITERAL("x.TXT")))); |
| 115 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( | 115 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( |
| 116 base::FilePath(FILE_PATH_LITERAL("x.foo")))); | 116 base::FilePath(FILE_PATH_LITERAL("x.foo")))); |
| 117 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( | 117 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( |
| 118 base::FilePath(FILE_PATH_LITERAL("x.Bar")))); | 118 base::FilePath(FILE_PATH_LITERAL("x.Bar")))); |
| 119 } | 119 } |
| 120 | |
| 121 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | |
| 122 TEST(DownloadPrefsTest, AlwaysOpenPdfExternally) { | |
| 123 content::TestBrowserThreadBundle threads_are_required_for_testing_profile; | |
| 124 TestingProfile profile; | |
| 125 profile.GetPrefs()->SetBoolean(prefs::kOpenPdfDownloadInSystemReader, false); | |
| 126 profile.GetPrefs()->SetBoolean(prefs::kPluginsAlwaysOpenPdfExternally, true); | |
| 127 DownloadPrefs prefs(&profile); | |
| 128 prefs.DisableAdobeVersionCheckForTests(); | |
| 129 | |
| 130 EXPECT_TRUE(prefs.ShouldOpenPdfInSystemReader()); | |
| 131 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( | |
| 132 base::FilePath(FILE_PATH_LITERAL("doc.pdf")))); | |
| 133 } | |
| 134 #endif | |
| OLD | NEW |