| 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 "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
| 6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 << "Actual dictionary " << PrettyJson(actual) | 227 << "Actual dictionary " << PrettyJson(actual) |
| 228 << " is missing field " << field; | 228 << " is missing field " << field; |
| 229 if (!expected_value->Equals(actual_value)) | 229 if (!expected_value->Equals(actual_value)) |
| 230 return testing::AssertionFailure() | 230 return testing::AssertionFailure() |
| 231 << "Field " << field << " mismatch: " << PrettyJson(*expected_value) | 231 << "Field " << field << " mismatch: " << PrettyJson(*expected_value) |
| 232 << " != " << PrettyJson(*actual_value); | 232 << " != " << PrettyJson(*actual_value); |
| 233 return testing::AssertionSuccess(); | 233 return testing::AssertionSuccess(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 static GURL UrlWithoutQuery(const GURL& url) { | 236 static GURL UrlWithoutQuery(const GURL& url) { |
| 237 url_canon::Replacements<char> replacements; | 237 url::Replacements<char> replacements; |
| 238 replacements.ClearQuery(); | 238 replacements.ClearQuery(); |
| 239 return url.ReplaceComponents(replacements); | 239 return url.ReplaceComponents(replacements); |
| 240 } | 240 } |
| 241 | 241 |
| 242 testing::AssertionResult IsTestServerUrl(const GURL& request_url) { | 242 testing::AssertionResult IsTestServerUrl(const GURL& request_url) { |
| 243 const GURL a(UrlWithoutQuery(test_server_url_)); | 243 const GURL a(UrlWithoutQuery(test_server_url_)); |
| 244 const GURL b(UrlWithoutQuery(request_url)); | 244 const GURL b(UrlWithoutQuery(request_url)); |
| 245 if (a == b) | 245 if (a == b) |
| 246 return testing::AssertionSuccess(); | 246 return testing::AssertionSuccess(); |
| 247 return testing::AssertionFailure() << a << " != " << b; | 247 return testing::AssertionFailure() << a << " != " << b; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); | 556 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); |
| 557 } else { | 557 } else { |
| 558 const int evicted = i - kCacheSize; | 558 const int evicted = i - kCacheSize; |
| 559 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); | 559 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); |
| 560 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); | 560 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); |
| 561 } | 561 } |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | 564 |
| 565 } // namespace content | 565 } // namespace content |
| OLD | NEW |