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