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 "base/prefs/pref_service.h" | |
9 #include "chrome/browser/download/download_extensions.h" | 8 #include "chrome/browser/download/download_extensions.h" |
10 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
11 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "components/prefs/pref_service.h" |
12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 TEST(DownloadPrefsTest, Prerequisites) { | 15 TEST(DownloadPrefsTest, Prerequisites) { |
16 // Most of the tests below are based on the assumption that .swf files are not | 16 // Most of the tests below are based on the assumption that .swf files are not |
17 // allowed to open automatically, and that .txt files are allowed. If this | 17 // allowed to open automatically, and that .txt files are allowed. If this |
18 // assumption changes, then we need to update the tests to match. | 18 // assumption changes, then we need to update the tests to match. |
19 ASSERT_FALSE(download_util::IsAllowedToOpenAutomatically( | 19 ASSERT_FALSE(download_util::IsAllowedToOpenAutomatically( |
20 base::FilePath(FILE_PATH_LITERAL("a.swf")))); | 20 base::FilePath(FILE_PATH_LITERAL("a.swf")))); |
21 ASSERT_TRUE(download_util::IsAllowedToOpenAutomatically( | 21 ASSERT_TRUE(download_util::IsAllowedToOpenAutomatically( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( | 109 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( |
110 base::FilePath(FILE_PATH_LITERAL("x.txt")))); | 110 base::FilePath(FILE_PATH_LITERAL("x.txt")))); |
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.foo")))); | 114 base::FilePath(FILE_PATH_LITERAL("x.foo")))); |
115 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( | 115 EXPECT_TRUE(prefs.IsAutoOpenEnabledBasedOnExtension( |
116 base::FilePath(FILE_PATH_LITERAL("x.Bar")))); | 116 base::FilePath(FILE_PATH_LITERAL("x.Bar")))); |
117 } | 117 } |
OLD | NEW |