Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: chrome/browser/download/download_prefs_unittest.cc

Issue 2369353002: Adds a pref and a policy to decide if PDFs should always be opened externally. (Closed)
Patch Set: Remove changes leaked in from the dependent branch. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/download/download_prefs.cc ('k') | chrome/browser/plugins/plugin_prefs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chrome/browser/download/download_prefs.cc ('k') | chrome/browser/plugins/plugin_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698