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 "chrome/browser/policy/device_status_collector.h" | 5 #include "chrome/browser/policy/device_status_collector.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 SetMockPositionToReturnNext(valid_fix); | 519 SetMockPositionToReturnNext(valid_fix); |
520 RestartStatusCollector(); | 520 RestartStatusCollector(); |
521 CheckThatAValidLocationIsReported(); | 521 CheckThatAValidLocationIsReported(); |
522 EXPECT_TRUE(mock_position_to_return_next.get()); | 522 EXPECT_TRUE(mock_position_to_return_next.get()); |
523 | 523 |
524 // Check that after disabling location reporting again, the last known | 524 // Check that after disabling location reporting again, the last known |
525 // location has been cleared from local state and is no longer reported. | 525 // location has been cleared from local state and is no longer reported. |
526 SetMockPositionToReturnNext(valid_fix); | 526 SetMockPositionToReturnNext(valid_fix); |
527 cros_settings_->SetBoolean(chromeos::kReportDeviceLocation, false); | 527 cros_settings_->SetBoolean(chromeos::kReportDeviceLocation, false); |
528 // Allow the new pref to propagate to the status collector. | 528 // Allow the new pref to propagate to the status collector. |
529 message_loop_.RunAllPending(); | 529 message_loop_.RunUntilIdle(); |
530 EXPECT_TRUE(prefs_.GetDictionary(prefs::kDeviceLocation)->empty()); | 530 EXPECT_TRUE(prefs_.GetDictionary(prefs::kDeviceLocation)->empty()); |
531 CheckThatNoLocationIsReported(); | 531 CheckThatNoLocationIsReported(); |
532 | 532 |
533 // Check that after enabling location reporting again, an error is reported | 533 // Check that after enabling location reporting again, an error is reported |
534 // if no valid fix is available. | 534 // if no valid fix is available. |
535 SetMockPositionToReturnNext(invalid_fix); | 535 SetMockPositionToReturnNext(invalid_fix); |
536 cros_settings_->SetBoolean(chromeos::kReportDeviceLocation, true); | 536 cros_settings_->SetBoolean(chromeos::kReportDeviceLocation, true); |
537 // Allow the new pref to propagate to the status collector. | 537 // Allow the new pref to propagate to the status collector. |
538 message_loop_.RunAllPending(); | 538 message_loop_.RunUntilIdle(); |
539 CheckThatALocationErrorIsReported(); | 539 CheckThatALocationErrorIsReported(); |
540 } | 540 } |
541 | 541 |
542 } // namespace policy | 542 } // namespace policy |
OLD | NEW |