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 // Disable everything on windows only. http://crbug.com/306144 | 5 // Disable everything on windows only. http://crbug.com/306144 |
6 #ifndef OS_WIN | 6 #ifndef OS_WIN |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/guid.h" | 15 #include "base/guid.h" |
16 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "base/threading/thread_restrictions.h" | 22 #include "base/threading/thread_restrictions.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "chrome/browser/download/download_core_service.h" |
| 25 #include "chrome/browser/download/download_core_service_factory.h" |
24 #include "chrome/browser/download/download_file_icon_extractor.h" | 26 #include "chrome/browser/download/download_file_icon_extractor.h" |
25 #include "chrome/browser/download/download_service.h" | |
26 #include "chrome/browser/download/download_service_factory.h" | |
27 #include "chrome/browser/download/download_test_file_activity_observer.h" | 27 #include "chrome/browser/download/download_test_file_activity_observer.h" |
28 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 28 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
29 #include "chrome/browser/extensions/browser_action_test_util.h" | 29 #include "chrome/browser/extensions/browser_action_test_util.h" |
30 #include "chrome/browser/extensions/extension_apitest.h" | 30 #include "chrome/browser/extensions/extension_apitest.h" |
31 #include "chrome/browser/extensions/extension_function_test_utils.h" | 31 #include "chrome/browser/extensions/extension_function_test_utils.h" |
32 #include "chrome/browser/net/url_request_mock_util.h" | 32 #include "chrome/browser/net/url_request_mock_util.h" |
33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
34 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
35 #include "chrome/browser/ui/browser_tabstrip.h" | 35 #include "chrome/browser/ui/browser_tabstrip.h" |
36 #include "chrome/common/extensions/api/downloads.h" | 36 #include "chrome/common/extensions/api/downloads.h" |
(...skipping 4101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4138 " \"state\": {" | 4138 " \"state\": {" |
4139 " \"previous\": \"in_progress\"," | 4139 " \"previous\": \"in_progress\"," |
4140 " \"current\": \"complete\"}}]", | 4140 " \"current\": \"complete\"}}]", |
4141 item->GetId()))); | 4141 item->GetId()))); |
4142 } | 4142 } |
4143 | 4143 |
4144 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, | 4144 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, |
4145 DownloadExtensionTest_SetShelfEnabled) { | 4145 DownloadExtensionTest_SetShelfEnabled) { |
4146 LoadExtension("downloads_split"); | 4146 LoadExtension("downloads_split"); |
4147 EXPECT_TRUE(RunFunction(new DownloadsSetShelfEnabledFunction(), "[false]")); | 4147 EXPECT_TRUE(RunFunction(new DownloadsSetShelfEnabledFunction(), "[false]")); |
4148 EXPECT_FALSE(DownloadServiceFactory::GetForBrowserContext( | 4148 EXPECT_FALSE( |
4149 browser()->profile())->IsShelfEnabled()); | 4149 DownloadCoreServiceFactory::GetForBrowserContext(browser()->profile()) |
| 4150 ->IsShelfEnabled()); |
4150 EXPECT_TRUE(RunFunction(new DownloadsSetShelfEnabledFunction(), "[true]")); | 4151 EXPECT_TRUE(RunFunction(new DownloadsSetShelfEnabledFunction(), "[true]")); |
4151 EXPECT_TRUE(DownloadServiceFactory::GetForBrowserContext( | 4152 EXPECT_TRUE( |
4152 browser()->profile())->IsShelfEnabled()); | 4153 DownloadCoreServiceFactory::GetForBrowserContext(browser()->profile()) |
| 4154 ->IsShelfEnabled()); |
4153 // TODO(benjhayden) Test that existing shelves are hidden. | 4155 // TODO(benjhayden) Test that existing shelves are hidden. |
4154 // TODO(benjhayden) Test multiple extensions. | 4156 // TODO(benjhayden) Test multiple extensions. |
4155 // TODO(benjhayden) Test disabling extensions. | 4157 // TODO(benjhayden) Test disabling extensions. |
4156 // TODO(benjhayden) Test that browsers associated with other profiles are not | 4158 // TODO(benjhayden) Test that browsers associated with other profiles are not |
4157 // affected. | 4159 // affected. |
4158 // TODO(benjhayden) Test incognito. | 4160 // TODO(benjhayden) Test incognito. |
4159 } | 4161 } |
4160 | 4162 |
4161 // TODO(benjhayden) Figure out why DisableExtension() does not fire | 4163 // TODO(benjhayden) Figure out why DisableExtension() does not fire |
4162 // OnListenerRemoved. | 4164 // OnListenerRemoved. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4303 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 4305 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
4304 EXPECT_FALSE(warnings.empty()); | 4306 EXPECT_FALSE(warnings.empty()); |
4305 EXPECT_EQ(Warning::kDownloadFilenameConflict, | 4307 EXPECT_EQ(Warning::kDownloadFilenameConflict, |
4306 warnings.begin()->warning_type()); | 4308 warnings.begin()->warning_type()); |
4307 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 4309 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
4308 } | 4310 } |
4309 | 4311 |
4310 } // namespace extensions | 4312 } // namespace extensions |
4311 | 4313 |
4312 #endif // http://crbug.com/306144 | 4314 #endif // http://crbug.com/306144 |
OLD | NEW |