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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/threading/thread_restrictions.h" |
9 #include "chrome/browser/download/download_prefs.h" | 10 #include "chrome/browser/download/download_prefs.h" |
10 #include "chrome/browser/net/prediction_options.h" | 11 #include "chrome/browser/net/prediction_options.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_commands.h" | 13 #include "chrome/browser/ui/browser_commands.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "chrome/test/base/testing_browser_process.h" | 18 #include "chrome/test/base/testing_browser_process.h" |
18 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
(...skipping 26 matching lines...) Expand all Loading... |
45 new content::DownloadTestObserverTerminal( | 46 new content::DownloadTestObserverTerminal( |
46 download_manager, | 47 download_manager, |
47 num_downloads, | 48 num_downloads, |
48 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); | 49 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); |
49 return base::WrapUnique(downloads_observer); | 50 return base::WrapUnique(downloads_observer); |
50 } | 51 } |
51 }; | 52 }; |
52 | 53 |
53 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestDownloadDirPref) { | 54 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestDownloadDirPref) { |
54 ASSERT_TRUE(embedded_test_server()->Start()); | 55 ASSERT_TRUE(embedded_test_server()->Start()); |
| 56 base::ThreadRestrictions::ScopedAllowIO allow_io; |
55 base::ScopedTempDir new_download_dir; | 57 base::ScopedTempDir new_download_dir; |
56 ASSERT_TRUE(new_download_dir.CreateUniqueTempDir()); | 58 ASSERT_TRUE(new_download_dir.CreateUniqueTempDir()); |
57 | 59 |
58 base::FilePath downloaded_pkg = | 60 base::FilePath downloaded_pkg = |
59 new_download_dir.GetPath().AppendASCII("a_zip_file.zip"); | 61 new_download_dir.GetPath().AppendASCII("a_zip_file.zip"); |
60 | 62 |
61 // Set pref to download in new_download_dir. | 63 // Set pref to download in new_download_dir. |
62 browser()->profile()->GetPrefs()->SetFilePath( | 64 browser()->profile()->GetPrefs()->SetFilePath( |
63 prefs::kDownloadDefaultDirectory, new_download_dir.GetPath()); | 65 prefs::kDownloadDefaultDirectory, new_download_dir.GetPath()); |
64 | 66 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 236 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
235 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 237 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
236 } | 238 } |
237 | 239 |
238 // Verify that we have some Local State prefs. | 240 // Verify that we have some Local State prefs. |
239 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestHaveLocalStatePrefs) { | 241 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestHaveLocalStatePrefs) { |
240 EXPECT_TRUE(g_browser_process->local_state() | 242 EXPECT_TRUE(g_browser_process->local_state() |
241 ->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS) | 243 ->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS) |
242 .get()); | 244 .get()); |
243 } | 245 } |
OLD | NEW |