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/environment.h" | 7 #include "base/environment.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 DeviceStatusCollectorTest() | 136 DeviceStatusCollectorTest() |
137 : message_loop_(MessageLoop::TYPE_UI), | 137 : message_loop_(MessageLoop::TYPE_UI), |
138 ui_thread_(content::BrowserThread::UI, &message_loop_), | 138 ui_thread_(content::BrowserThread::UI, &message_loop_), |
139 file_thread_(content::BrowserThread::FILE, &message_loop_), | 139 file_thread_(content::BrowserThread::FILE, &message_loop_), |
140 io_thread_(content::BrowserThread::IO, &message_loop_) { | 140 io_thread_(content::BrowserThread::IO, &message_loop_) { |
141 // Run this test with a well-known timezone so that Time::LocalMidnight() | 141 // Run this test with a well-known timezone so that Time::LocalMidnight() |
142 // returns the same values on all machines. | 142 // returns the same values on all machines. |
143 scoped_ptr<base::Environment> env(base::Environment::Create()); | 143 scoped_ptr<base::Environment> env(base::Environment::Create()); |
144 env->SetVar("TZ", "UTC"); | 144 env->SetVar("TZ", "UTC"); |
145 | 145 |
146 TestingDeviceStatusCollector::RegisterPrefs(&prefs_); | 146 TestingDeviceStatusCollector::RegisterPrefs(prefs_.registry()); |
147 | 147 |
148 EXPECT_CALL(statistics_provider_, GetMachineStatistic(_, NotNull())) | 148 EXPECT_CALL(statistics_provider_, GetMachineStatistic(_, NotNull())) |
149 .WillRepeatedly(Return(false)); | 149 .WillRepeatedly(Return(false)); |
150 | 150 |
151 // Remove the real DeviceSettingsProvider and replace it with a stub. | 151 // Remove the real DeviceSettingsProvider and replace it with a stub. |
152 cros_settings_ = chromeos::CrosSettings::Get(); | 152 cros_settings_ = chromeos::CrosSettings::Get(); |
153 device_settings_provider_ = | 153 device_settings_provider_ = |
154 cros_settings_->GetProvider(chromeos::kReportDeviceVersionInfo); | 154 cros_settings_->GetProvider(chromeos::kReportDeviceVersionInfo); |
155 EXPECT_TRUE(device_settings_provider_ != NULL); | 155 EXPECT_TRUE(device_settings_provider_ != NULL); |
156 EXPECT_TRUE( | 156 EXPECT_TRUE( |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // Check that after enabling location reporting again, an error is reported | 564 // Check that after enabling location reporting again, an error is reported |
565 // if no valid fix is available. | 565 // if no valid fix is available. |
566 SetMockPositionToReturnNext(invalid_fix); | 566 SetMockPositionToReturnNext(invalid_fix); |
567 cros_settings_->SetBoolean(chromeos::kReportDeviceLocation, true); | 567 cros_settings_->SetBoolean(chromeos::kReportDeviceLocation, true); |
568 // Allow the new pref to propagate to the status collector. | 568 // Allow the new pref to propagate to the status collector. |
569 message_loop_.RunUntilIdle(); | 569 message_loop_.RunUntilIdle(); |
570 CheckThatALocationErrorIsReported(); | 570 CheckThatALocationErrorIsReported(); |
571 } | 571 } |
572 | 572 |
573 } // namespace policy | 573 } // namespace policy |
OLD | NEW |