OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/threading/thread_restrictions.h" |
9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
10 #include "chrome/browser/download/download_prefs.h" | 11 #include "chrome/browser/download/download_prefs.h" |
11 #include "chrome/browser/extensions/extension_apitest.h" | 12 #include "chrome/browser/extensions/extension_apitest.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/common/extensions/api/streams_private.h" | 16 #include "chrome/common/extensions/api/streams_private.h" |
16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
18 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 144 } |
144 | 145 |
145 void TearDownOnMainThread() override { | 146 void TearDownOnMainThread() override { |
146 // Tear down the test server. | 147 // Tear down the test server. |
147 EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete()); | 148 EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete()); |
148 test_server_.reset(); | 149 test_server_.reset(); |
149 ExtensionApiTest::TearDownOnMainThread(); | 150 ExtensionApiTest::TearDownOnMainThread(); |
150 } | 151 } |
151 | 152 |
152 void InitializeDownloadSettings() { | 153 void InitializeDownloadSettings() { |
| 154 base::ThreadRestrictions::ScopedAllowIO allow_io; |
153 ASSERT_TRUE(browser()); | 155 ASSERT_TRUE(browser()); |
154 ASSERT_TRUE(downloads_dir_.CreateUniqueTempDir()); | 156 ASSERT_TRUE(downloads_dir_.CreateUniqueTempDir()); |
155 | 157 |
156 // Setup default downloads directory to the scoped tmp directory created for | 158 // Setup default downloads directory to the scoped tmp directory created for |
157 // the test. | 159 // the test. |
158 browser()->profile()->GetPrefs()->SetFilePath( | 160 browser()->profile()->GetPrefs()->SetFilePath( |
159 prefs::kDownloadDefaultDirectory, downloads_dir_.GetPath()); | 161 prefs::kDownloadDefaultDirectory, downloads_dir_.GetPath()); |
160 // Ensure there are no prompts for download during the test. | 162 // Ensure there are no prompts for download during the test. |
161 browser()->profile()->GetPrefs()->SetBoolean( | 163 browser()->profile()->GetPrefs()->SetBoolean( |
162 prefs::kPromptForDownload, false); | 164 prefs::kPromptForDownload, false); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 base::RunLoop().RunUntilIdle(); | 447 base::RunLoop().RunUntilIdle(); |
446 EXPECT_TRUE(catcher.GetNextResult()); | 448 EXPECT_TRUE(catcher.GetNextResult()); |
447 | 449 |
448 ui_test_utils::NavigateToURL(browser(), | 450 ui_test_utils::NavigateToURL(browser(), |
449 test_server_->GetURL("/abort.rtf")); | 451 test_server_->GetURL("/abort.rtf")); |
450 base::RunLoop().RunUntilIdle(); | 452 base::RunLoop().RunUntilIdle(); |
451 EXPECT_TRUE(catcher.GetNextResult()); | 453 EXPECT_TRUE(catcher.GetNextResult()); |
452 } | 454 } |
453 | 455 |
454 } // namespace | 456 } // namespace |
OLD | NEW |