OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 "latitude=200.000000, longitude=200.000000, accuracy=-1.000000, " | 275 "latitude=200.000000, longitude=200.000000, accuracy=-1.000000, " |
276 "error_code=0, error_message='SimpleGeolocation provider at " | 276 "error_code=0, error_message='SimpleGeolocation provider at " |
277 "'https://localhost/' : JSONReader failed: Line: 1, column: 1, " | 277 "'https://localhost/' : JSONReader failed: Line: 1, column: 1, " |
278 "Unexpected token..', status=4 (TIMEOUT)", | 278 "Unexpected token..', status=4 (TIMEOUT)", |
279 receiver.position().ToString()); | 279 receiver.position().ToString()); |
280 EXPECT_TRUE(receiver.server_error()); | 280 EXPECT_TRUE(receiver.server_error()); |
281 EXPECT_GE(url_factory.attempts(), 2U); | 281 EXPECT_GE(url_factory.attempts(), 2U); |
282 if (url_factory.attempts() > expected_retries + 1) { | 282 if (url_factory.attempts() > expected_retries + 1) { |
283 LOG(WARNING) | 283 LOG(WARNING) |
284 << "SimpleGeolocationTest::InvalidResponse: Too many attempts (" | 284 << "SimpleGeolocationTest::InvalidResponse: Too many attempts (" |
285 << url_factory.attempts() << "), no more then " << expected_retries + 1 | 285 << url_factory.attempts() << "), no more than " << expected_retries + 1 |
286 << " expected."; | 286 << " expected."; |
287 } | 287 } |
288 if (url_factory.attempts() < expected_retries - 1) { | 288 if (url_factory.attempts() < expected_retries - 1) { |
289 LOG(WARNING) | 289 LOG(WARNING) |
290 << "SimpleGeolocationTest::InvalidResponse: Too little attempts (" | 290 << "SimpleGeolocationTest::InvalidResponse: Too little attempts (" |
291 << url_factory.attempts() << "), greater then " << expected_retries - 1 | 291 << url_factory.attempts() << "), greater than " << expected_retries - 1 |
292 << " expected."; | 292 << " expected."; |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 TEST_F(SimpleGeolocationTest, NoWiFi) { | 296 TEST_F(SimpleGeolocationTest, NoWiFi) { |
297 // This initializes DBusThreadManager and markes it "for tests only". | 297 // This initializes DBusThreadManager and markes it "for tests only". |
298 DBusThreadManager::GetSetterForTesting(); | 298 DBusThreadManager::GetSetterForTesting(); |
299 NetworkHandler::Initialize(); | 299 NetworkHandler::Initialize(); |
300 | 300 |
301 WiFiTestMonitor requests_monitor; | 301 WiFiTestMonitor requests_monitor; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 438 } |
439 NetworkHandler::Shutdown(); | 439 NetworkHandler::Shutdown(); |
440 } | 440 } |
441 | 441 |
442 // This test verifies that WiFi data is sent only if sending was requested. | 442 // This test verifies that WiFi data is sent only if sending was requested. |
443 INSTANTIATE_TEST_CASE_P(EnableDisableSendingWifiData, | 443 INSTANTIATE_TEST_CASE_P(EnableDisableSendingWifiData, |
444 SimpleGeolocationWiFiTest, | 444 SimpleGeolocationWiFiTest, |
445 testing::Bool()); | 445 testing::Bool()); |
446 | 446 |
447 } // namespace chromeos | 447 } // namespace chromeos |
OLD | NEW |