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 <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 base::Time caught_; | 169 base::Time caught_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(Event); | 171 DISALLOW_COPY_AND_ASSIGN(Event); |
172 }; | 172 }; |
173 | 173 |
174 typedef ExtensionDownloadsEventRouter::DownloadsNotificationSource | 174 typedef ExtensionDownloadsEventRouter::DownloadsNotificationSource |
175 DownloadsNotificationSource; | 175 DownloadsNotificationSource; |
176 | 176 |
177 virtual void Observe(int type, | 177 virtual void Observe(int type, |
178 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
179 const content::NotificationDetails& details) OVERRIDE { | 179 const content::NotificationDetails& details) override { |
180 switch (type) { | 180 switch (type) { |
181 case extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: { | 181 case extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: { |
182 DownloadsNotificationSource* dns = | 182 DownloadsNotificationSource* dns = |
183 content::Source<DownloadsNotificationSource>(source).ptr(); | 183 content::Source<DownloadsNotificationSource>(source).ptr(); |
184 Event* new_event = new Event( | 184 Event* new_event = new Event( |
185 dns->profile, | 185 dns->profile, |
186 dns->event_name, | 186 dns->event_name, |
187 *content::Details<std::string>(details).ptr(), base::Time::Now()); | 187 *content::Details<std::string>(details).ptr(), base::Time::Now()); |
188 events_.push_back(new_event); | 188 events_.push_back(new_event); |
189 if (waiting_ && | 189 if (waiting_ && |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 305 } |
306 | 306 |
307 void RemoveFilenameDeterminer(content::RenderProcessHost* host) { | 307 void RemoveFilenameDeterminer(content::RenderProcessHost* host) { |
308 EventRouter::Get(current_browser()->profile())->RemoveEventListener( | 308 EventRouter::Get(current_browser()->profile())->RemoveEventListener( |
309 downloads::OnDeterminingFilename::kEventName, host, GetExtensionId()); | 309 downloads::OnDeterminingFilename::kEventName, host, GetExtensionId()); |
310 } | 310 } |
311 | 311 |
312 Browser* current_browser() { return current_browser_; } | 312 Browser* current_browser() { return current_browser_; } |
313 | 313 |
314 // InProcessBrowserTest | 314 // InProcessBrowserTest |
315 virtual void SetUpOnMainThread() OVERRIDE { | 315 virtual void SetUpOnMainThread() override { |
316 ExtensionApiTest::SetUpOnMainThread(); | 316 ExtensionApiTest::SetUpOnMainThread(); |
317 BrowserThread::PostTask( | 317 BrowserThread::PostTask( |
318 BrowserThread::IO, FROM_HERE, | 318 BrowserThread::IO, FROM_HERE, |
319 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 319 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
320 InProcessBrowserTest::SetUpOnMainThread(); | 320 InProcessBrowserTest::SetUpOnMainThread(); |
321 GoOnTheRecord(); | 321 GoOnTheRecord(); |
322 CreateAndSetDownloadsDirectory(); | 322 CreateAndSetDownloadsDirectory(); |
323 current_browser()->profile()->GetPrefs()->SetBoolean( | 323 current_browser()->profile()->GetPrefs()->SetBoolean( |
324 prefs::kPromptForDownload, false); | 324 prefs::kPromptForDownload, false); |
325 GetOnRecordManager()->RemoveAllDownloads(); | 325 GetOnRecordManager()->RemoveAllDownloads(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 const std::string& response) | 615 const std::string& response) |
616 : expected_path_(path), | 616 : expected_path_(path), |
617 expected_icon_size_(icon_size), | 617 expected_icon_size_(icon_size), |
618 response_(response) { | 618 response_(response) { |
619 } | 619 } |
620 virtual ~MockIconExtractorImpl() {} | 620 virtual ~MockIconExtractorImpl() {} |
621 | 621 |
622 virtual bool ExtractIconURLForPath(const base::FilePath& path, | 622 virtual bool ExtractIconURLForPath(const base::FilePath& path, |
623 float scale, | 623 float scale, |
624 IconLoader::IconSize icon_size, | 624 IconLoader::IconSize icon_size, |
625 IconURLCallback callback) OVERRIDE { | 625 IconURLCallback callback) override { |
626 EXPECT_STREQ(expected_path_.value().c_str(), path.value().c_str()); | 626 EXPECT_STREQ(expected_path_.value().c_str(), path.value().c_str()); |
627 EXPECT_EQ(expected_icon_size_, icon_size); | 627 EXPECT_EQ(expected_icon_size_, icon_size); |
628 if (expected_path_ == path && | 628 if (expected_path_ == path && |
629 expected_icon_size_ == icon_size) { | 629 expected_icon_size_ == icon_size) { |
630 callback_ = callback; | 630 callback_ = callback; |
631 BrowserThread::PostTask( | 631 BrowserThread::PostTask( |
632 BrowserThread::UI, FROM_HERE, | 632 BrowserThread::UI, FROM_HERE, |
633 base::Bind(&MockIconExtractorImpl::RunCallback, | 633 base::Bind(&MockIconExtractorImpl::RunCallback, |
634 base::Unretained(this))); | 634 base::Unretained(this))); |
635 return true; | 635 return true; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 : public content::DownloadTestObserverInProgress { | 754 : public content::DownloadTestObserverInProgress { |
755 public: | 755 public: |
756 JustInProgressDownloadObserver( | 756 JustInProgressDownloadObserver( |
757 DownloadManager* download_manager, size_t wait_count) | 757 DownloadManager* download_manager, size_t wait_count) |
758 : content::DownloadTestObserverInProgress(download_manager, wait_count) { | 758 : content::DownloadTestObserverInProgress(download_manager, wait_count) { |
759 } | 759 } |
760 | 760 |
761 virtual ~JustInProgressDownloadObserver() {} | 761 virtual ~JustInProgressDownloadObserver() {} |
762 | 762 |
763 private: | 763 private: |
764 virtual bool IsDownloadInFinalState(DownloadItem* item) OVERRIDE { | 764 virtual bool IsDownloadInFinalState(DownloadItem* item) override { |
765 return item->GetState() == DownloadItem::IN_PROGRESS; | 765 return item->GetState() == DownloadItem::IN_PROGRESS; |
766 } | 766 } |
767 | 767 |
768 DISALLOW_COPY_AND_ASSIGN(JustInProgressDownloadObserver); | 768 DISALLOW_COPY_AND_ASSIGN(JustInProgressDownloadObserver); |
769 }; | 769 }; |
770 | 770 |
771 bool ItemIsInterrupted(DownloadItem* item) { | 771 bool ItemIsInterrupted(DownloadItem* item) { |
772 return item->GetState() == DownloadItem::INTERRUPTED; | 772 return item->GetState() == DownloadItem::INTERRUPTED; |
773 } | 773 } |
774 | 774 |
(...skipping 3380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4155 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 4155 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
4156 EXPECT_FALSE(warnings.empty()); | 4156 EXPECT_FALSE(warnings.empty()); |
4157 EXPECT_EQ(Warning::kDownloadFilenameConflict, | 4157 EXPECT_EQ(Warning::kDownloadFilenameConflict, |
4158 warnings.begin()->warning_type()); | 4158 warnings.begin()->warning_type()); |
4159 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 4159 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
4160 } | 4160 } |
4161 | 4161 |
4162 } // namespace extensions | 4162 } // namespace extensions |
4163 | 4163 |
4164 #endif // http://crbug.com/3061144 | 4164 #endif // http://crbug.com/3061144 |
OLD | NEW |