| OLD | NEW |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 std::unique_ptr<MockDownloadManager> manager_; | 102 std::unique_ptr<MockDownloadManager> manager_; |
| 103 content::DownloadManager::Observer* download_history_manager_observer_; | 103 content::DownloadManager::Observer* download_history_manager_observer_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(DownloadsApiUnitTest); | 105 DISALLOW_COPY_AND_ASSIGN(DownloadsApiUnitTest); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 // static | 108 // static |
| 109 std::unique_ptr<KeyedService> | 109 std::unique_ptr<KeyedService> |
| 110 DownloadsApiUnitTest::TestingDownloadServiceFactory( | 110 DownloadsApiUnitTest::TestingDownloadServiceFactory( |
| 111 content::BrowserContext* browser_context) { | 111 content::BrowserContext* browser_context) { |
| 112 return base::WrapUnique( | 112 return base::MakeUnique<TestDownloadService>( |
| 113 new TestDownloadService(Profile::FromBrowserContext(browser_context))); | 113 Profile::FromBrowserContext(browser_context)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Tests that Number/double properties in query are parsed correctly. | 116 // Tests that Number/double properties in query are parsed correctly. |
| 117 // Regression test for https://crbug.com/617435. | 117 // Regression test for https://crbug.com/617435. |
| 118 TEST_F(DownloadsApiUnitTest, ParseSearchQuery) { | 118 TEST_F(DownloadsApiUnitTest, ParseSearchQuery) { |
| 119 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesLess\":1}]"); | 119 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesLess\":1}]"); |
| 120 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesGreater\":2}]"); | 120 RunFunction(new DownloadsSearchFunction, "[{\"totalBytesGreater\":2}]"); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |