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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 private: | 93 private: |
94 std::vector<content::MockDownloadItem*> mocks_; | 94 std::vector<content::MockDownloadItem*> mocks_; |
95 DownloadQuery query_; | 95 DownloadQuery query_; |
96 DownloadVector results_; | 96 DownloadVector results_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(DownloadQueryTest); | 98 DISALLOW_COPY_AND_ASSIGN(DownloadQueryTest); |
99 }; | 99 }; |
100 | 100 |
101 template<> void DownloadQueryTest::AddFilter( | 101 template<> void DownloadQueryTest::AddFilter( |
102 DownloadQuery::FilterType name, bool cpp_value) { | 102 DownloadQuery::FilterType name, bool cpp_value) { |
103 scoped_ptr<base::Value> value(base::Value::CreateBooleanValue(cpp_value)); | 103 scoped_ptr<base::Value> value(new base::FundamentalValue(cpp_value)); |
104 CHECK(query_.AddFilter(name, *value.get())); | 104 CHECK(query_.AddFilter(name, *value.get())); |
105 } | 105 } |
106 | 106 |
107 template<> void DownloadQueryTest::AddFilter( | 107 template<> void DownloadQueryTest::AddFilter( |
108 DownloadQuery::FilterType name, int cpp_value) { | 108 DownloadQuery::FilterType name, int cpp_value) { |
109 scoped_ptr<base::Value> value(base::Value::CreateIntegerValue(cpp_value)); | 109 scoped_ptr<base::Value> value(base::Value::CreateIntegerValue(cpp_value)); |
110 CHECK(query_.AddFilter(name, *value.get())); | 110 CHECK(query_.AddFilter(name, *value.get())); |
111 } | 111 } |
112 | 112 |
113 template<> void DownloadQueryTest::AddFilter( | 113 template<> void DownloadQueryTest::AddFilter( |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 base::Time start = base::Time::Now(); | 605 base::Time start = base::Time::Now(); |
606 Search(); | 606 Search(); |
607 base::Time end = base::Time::Now(); | 607 base::Time end = base::Time::Now(); |
608 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; | 608 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; |
609 double nanos_per_item = nanos / static_cast<double>(kNumItems); | 609 double nanos_per_item = nanos / static_cast<double>(kNumItems); |
610 double nanos_per_item_per_filter = nanos_per_item | 610 double nanos_per_item_per_filter = nanos_per_item |
611 / static_cast<double>(kNumFilters); | 611 / static_cast<double>(kNumFilters); |
612 std::cout << "Search took " << nanos_per_item_per_filter | 612 std::cout << "Search took " << nanos_per_item_per_filter |
613 << " nanoseconds per item per filter.\n"; | 613 << " nanoseconds per item per filter.\n"; |
614 } | 614 } |
OLD | NEW |