| 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 #include "chrome/browser/download/download_query.h" | 5 #include "chrome/browser/download/download_query.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // anonymous namespace | 54 } // anonymous namespace |
| 55 | 55 |
| 56 class DownloadQueryTest : public testing::Test { | 56 class DownloadQueryTest : public testing::Test { |
| 57 public: | 57 public: |
| 58 DownloadQueryTest() {} | 58 DownloadQueryTest() {} |
| 59 | 59 |
| 60 ~DownloadQueryTest() override {} | 60 ~DownloadQueryTest() override {} |
| 61 | 61 |
| 62 void TearDown() override { STLDeleteElements(&mocks_); } | 62 void TearDown() override { base::STLDeleteElements(&mocks_); } |
| 63 | 63 |
| 64 void CreateMocks(int count) { | 64 void CreateMocks(int count) { |
| 65 for (int i = 0; i < count; ++i) { | 65 for (int i = 0; i < count; ++i) { |
| 66 mocks_.push_back(new content::MockDownloadItem()); | 66 mocks_.push_back(new content::MockDownloadItem()); |
| 67 EXPECT_CALL(mock(mocks_.size() - 1), GetId()).WillRepeatedly(Return( | 67 EXPECT_CALL(mock(mocks_.size() - 1), GetId()).WillRepeatedly(Return( |
| 68 mocks_.size() - 1)); | 68 mocks_.size() - 1)); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 content::MockDownloadItem& mock(int index) { return *mocks_[index]; } | 72 content::MockDownloadItem& mock(int index) { return *mocks_[index]; } |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 base::Time start = base::Time::Now(); | 787 base::Time start = base::Time::Now(); |
| 788 Search(); | 788 Search(); |
| 789 base::Time end = base::Time::Now(); | 789 base::Time end = base::Time::Now(); |
| 790 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; | 790 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; |
| 791 double nanos_per_item = nanos / static_cast<double>(kNumItems); | 791 double nanos_per_item = nanos / static_cast<double>(kNumItems); |
| 792 double nanos_per_item_per_filter = nanos_per_item | 792 double nanos_per_item_per_filter = nanos_per_item |
| 793 / static_cast<double>(kNumFilters); | 793 / static_cast<double>(kNumFilters); |
| 794 std::cout << "Search took " << nanos_per_item_per_filter | 794 std::cout << "Search took " << nanos_per_item_per_filter |
| 795 << " nanoseconds per item per filter.\n"; | 795 << " nanoseconds per item per filter.\n"; |
| 796 } | 796 } |
| OLD | NEW |