| Index: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
 | 
| diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
 | 
| index a2b8a6b229d5c844787fc9b673da09e0d728d0b0..5e9a6d15010305972b4550be705e6e99e4430037 100644
 | 
| --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
 | 
| +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
 | 
| @@ -4,6 +4,8 @@
 | 
|  
 | 
|  #include "chrome/browser/extensions/api/downloads/downloads_api.h"
 | 
|  
 | 
| +#include <algorithm>
 | 
| +
 | 
|  #include "base/macros.h"
 | 
|  #include "base/memory/ptr_util.h"
 | 
|  #include "chrome/browser/download/download_core_service_factory.h"
 | 
| @@ -127,4 +129,49 @@ TEST_F(DownloadsApiUnitTest, ParseSearchQuery) {
 | 
|    RunFunction(new DownloadsSearchFunction, "[{\"totalBytesGreater\":2}]");
 | 
|  }
 | 
|  
 | 
| +// Marked as an "internal" unit test because it doesn't use the TEST_F macro so
 | 
| +// the name must be different.
 | 
| +TEST(DownloadsApiInternalUnitTest, FilterTypeSorted) {
 | 
| +  struct KeyCompare {
 | 
| +    bool operator()(const DownloadQueryFilterTypePair& a,
 | 
| +                    const DownloadQueryFilterTypePair& b) const {
 | 
| +      return strcmp(a.first, b.first) < 0;
 | 
| +    }
 | 
| +  };
 | 
| +  EXPECT_TRUE(std::is_sorted(DownloadQueryFilterTypeBeginForTest(),
 | 
| +                             DownloadQueryFilterTypeEndForTest(),
 | 
| +                             KeyCompare()));
 | 
| +
 | 
| +  // All items should be found.
 | 
| +  for (const DownloadQueryFilterTypePair* cur =
 | 
| +           DownloadQueryFilterTypeBeginForTest();
 | 
| +       cur != DownloadQueryFilterTypeEndForTest(); ++cur) {
 | 
| +    EXPECT_EQ(cur, FindDownloadFilterTypeByString(cur->first));
 | 
| +  }
 | 
| +
 | 
| +  EXPECT_EQ(nullptr, FindDownloadFilterTypeByString("NOTFOUND"));
 | 
| +}
 | 
| +
 | 
| +// Marked as an "internal" unit test because it doesn't use the TEST_F macro so
 | 
| +// the name must be different.
 | 
| +TEST(DownloadsApiInternalUnitTest, SortTypeSorted) {
 | 
| +  struct KeyCompare {
 | 
| +    bool operator()(const DownloadQuerySortTypePair& a,
 | 
| +                    const DownloadQuerySortTypePair& b) const {
 | 
| +      return strcmp(a.first, b.first) < 0;
 | 
| +    }
 | 
| +  };
 | 
| +  EXPECT_TRUE(std::is_sorted(DownloadQuerySortTypeBeginForTest(),
 | 
| +                             DownloadQuerySortTypeEndForTest(), KeyCompare()));
 | 
| +
 | 
| +  // All items should be found.
 | 
| +  for (const DownloadQuerySortTypePair* cur =
 | 
| +           DownloadQuerySortTypeBeginForTest();
 | 
| +       cur != DownloadQuerySortTypeEndForTest(); ++cur) {
 | 
| +    EXPECT_EQ(cur, FindDownloadSortTypeByString(cur->first));
 | 
| +  }
 | 
| +
 | 
| +  EXPECT_EQ(nullptr, FindDownloadSortTypeByString("NOTFOUND"));
 | 
| +}
 | 
| +
 | 
|  }  // namespace extensions
 | 
| 
 |