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/component_updater/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 | 221 |
222 // Verify that the component updater can be caught in a quick | 222 // Verify that the component updater can be caught in a quick |
223 // start-shutdown situation. Failure of this test will be a crash. Also | 223 // start-shutdown situation. Failure of this test will be a crash. Also |
224 // if there is no work to do, there are no notifications generated. | 224 // if there is no work to do, there are no notifications generated. |
225 TEST_F(ComponentUpdaterTest, StartStop) { | 225 TEST_F(ComponentUpdaterTest, StartStop) { |
226 MessageLoop message_loop; | 226 MessageLoop message_loop; |
227 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); | 227 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
228 | 228 |
229 component_updater()->Start(); | 229 component_updater()->Start(); |
230 message_loop.RunAllPending(); | 230 message_loop.RunUntilIdle(); |
231 component_updater()->Stop(); | 231 component_updater()->Stop(); |
232 | 232 |
233 EXPECT_EQ(0ul, notification_tracker().size()); | 233 EXPECT_EQ(0ul, notification_tracker().size()); |
234 } | 234 } |
235 | 235 |
236 // Verify that when the server has no updates, we go back to sleep and | 236 // Verify that when the server has no updates, we go back to sleep and |
237 // the COMPONENT_UPDATER_STARTED and COMPONENT_UPDATER_SLEEPING notifications | 237 // the COMPONENT_UPDATER_STARTED and COMPONENT_UPDATER_SLEEPING notifications |
238 // are generated. | 238 // are generated. |
239 TEST_F(ComponentUpdaterTest, CheckCrxSleep) { | 239 TEST_F(ComponentUpdaterTest, CheckCrxSleep) { |
240 MessageLoop message_loop; | 240 MessageLoop message_loop; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 test_configurator()->SetLoopCount(1); | 408 test_configurator()->SetLoopCount(1); |
409 component_updater()->Start(); | 409 component_updater()->Start(); |
410 message_loop.Run(); | 410 message_loop.Run(); |
411 | 411 |
412 EXPECT_EQ(1, interceptor->hit_count()); | 412 EXPECT_EQ(1, interceptor->hit_count()); |
413 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); | 413 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); |
414 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); | 414 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); |
415 | 415 |
416 component_updater()->Stop(); | 416 component_updater()->Stop(); |
417 } | 417 } |
OLD | NEW |