| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 CHECK(query_.AddFilter(name, *value.get())); | 116 CHECK(query_.AddFilter(name, *value.get())); |
| 117 } | 117 } |
| 118 | 118 |
| 119 template<> void DownloadQueryTest::AddFilter( | 119 template<> void DownloadQueryTest::AddFilter( |
| 120 DownloadQuery::FilterType name, std::string cpp_value) { | 120 DownloadQuery::FilterType name, std::string cpp_value) { |
| 121 scoped_ptr<base::Value> value(base::Value::CreateStringValue(cpp_value)); | 121 scoped_ptr<base::Value> value(base::Value::CreateStringValue(cpp_value)); |
| 122 CHECK(query_.AddFilter(name, *value.get())); | 122 CHECK(query_.AddFilter(name, *value.get())); |
| 123 } | 123 } |
| 124 | 124 |
| 125 template<> void DownloadQueryTest::AddFilter( | 125 template<> void DownloadQueryTest::AddFilter( |
| 126 DownloadQuery::FilterType name, const char16* cpp_value) { | 126 DownloadQuery::FilterType name, const base::char16* cpp_value) { |
| 127 scoped_ptr<base::Value> value( | 127 scoped_ptr<base::Value> value( |
| 128 base::Value::CreateStringValue(base::string16(cpp_value))); | 128 base::Value::CreateStringValue(base::string16(cpp_value))); |
| 129 CHECK(query_.AddFilter(name, *value.get())); | 129 CHECK(query_.AddFilter(name, *value.get())); |
| 130 } | 130 } |
| 131 | 131 |
| 132 template<> void DownloadQueryTest::AddFilter( | 132 template<> void DownloadQueryTest::AddFilter( |
| 133 DownloadQuery::FilterType name, std::vector<base::string16> cpp_value) { | 133 DownloadQuery::FilterType name, std::vector<base::string16> cpp_value) { |
| 134 scoped_ptr<base::ListValue> list(new base::ListValue()); | 134 scoped_ptr<base::ListValue> list(new base::ListValue()); |
| 135 for (std::vector<base::string16>::const_iterator it = cpp_value.begin(); | 135 for (std::vector<base::string16>::const_iterator it = cpp_value.begin(); |
| 136 it != cpp_value.end(); ++it) { | 136 it != cpp_value.end(); ++it) { |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 base::Time start = base::Time::Now(); | 610 base::Time start = base::Time::Now(); |
| 611 Search(); | 611 Search(); |
| 612 base::Time end = base::Time::Now(); | 612 base::Time end = base::Time::Now(); |
| 613 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; | 613 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; |
| 614 double nanos_per_item = nanos / static_cast<double>(kNumItems); | 614 double nanos_per_item = nanos / static_cast<double>(kNumItems); |
| 615 double nanos_per_item_per_filter = nanos_per_item | 615 double nanos_per_item_per_filter = nanos_per_item |
| 616 / static_cast<double>(kNumFilters); | 616 / static_cast<double>(kNumFilters); |
| 617 std::cout << "Search took " << nanos_per_item_per_filter | 617 std::cout << "Search took " << nanos_per_item_per_filter |
| 618 << " nanoseconds per item per filter.\n"; | 618 << " nanoseconds per item per filter.\n"; |
| 619 } | 619 } |
| OLD | NEW |