Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc

Issue 2749823002: Restore KeyedServiceFactory diagnostics for context use-after-destroy. (Closed)
Patch Set: Refactor SiteEngagementService tests. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/extensions/api/downloads/downloads_api.h" 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/download/download_history.h" 9 #include "chrome/browser/download/download_history.h"
10 #include "chrome/browser/download/download_service_factory.h" 10 #include "chrome/browser/download/download_service_factory.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace { 23 namespace {
24 24
25 // A DownloadService that returns a custom DownloadHistory. 25 // A DownloadService that returns a custom DownloadHistory.
26 class TestDownloadService : public DownloadServiceImpl { 26 class TestDownloadService : public DownloadServiceImpl {
27 public: 27 public:
28 explicit TestDownloadService(Profile* profile) 28 explicit TestDownloadService(Profile* profile)
29 : DownloadServiceImpl(profile), profile_(profile) {} 29 : DownloadServiceImpl(profile), profile_(profile) {}
30 ~TestDownloadService() override {} 30 ~TestDownloadService() override {}
31 31
32 void Shutdown() override {
33 DownloadServiceImpl::Shutdown();
34 download_history_.reset();
35 router_.reset();
36 }
37
32 void set_download_history(std::unique_ptr<DownloadHistory> download_history) { 38 void set_download_history(std::unique_ptr<DownloadHistory> download_history) {
33 download_history_.swap(download_history); 39 download_history_.swap(download_history);
34 } 40 }
35 41
36 DownloadHistory* GetDownloadHistory() override { 42 DownloadHistory* GetDownloadHistory() override {
37 return download_history_.get(); 43 return download_history_.get();
38 } 44 }
39 45
40 ExtensionDownloadsEventRouter* GetExtensionEventRouter() override { 46 ExtensionDownloadsEventRouter* GetExtensionEventRouter() override {
41 if (!router_.get()) { 47 if (!router_.get()) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 120 }
115 121
116 // Tests that Number/double properties in query are parsed correctly. 122 // Tests that Number/double properties in query are parsed correctly.
117 // Regression test for https://crbug.com/617435. 123 // Regression test for https://crbug.com/617435.
118 TEST_F(DownloadsApiUnitTest, ParseSearchQuery) { 124 TEST_F(DownloadsApiUnitTest, ParseSearchQuery) {
119 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesLess\":1}]"); 125 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesLess\":1}]");
120 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesGreater\":2}]"); 126 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesGreater\":2}]");
121 } 127 }
122 128
123 } // namespace extensions 129 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698