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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // Set how many update checks are called, the default value is just once. | 76 // Set how many update checks are called, the default value is just once. |
77 void SetLoopCount(int times) { times_ = times; } | 77 void SetLoopCount(int times) { times_ = times; } |
78 | 78 |
79 private: | 79 private: |
80 int times_; | 80 int times_; |
81 }; | 81 }; |
82 | 82 |
83 class TestInstaller : public ComponentInstaller { | 83 class TestInstaller : public ComponentInstaller { |
84 public : | 84 public : |
85 explicit TestInstaller() | 85 TestInstaller() |
86 : error_(0), install_count_(0) { | 86 : error_(0), install_count_(0) { |
87 } | 87 } |
88 | 88 |
89 virtual void OnUpdateError(int error) OVERRIDE { | 89 virtual void OnUpdateError(int error) OVERRIDE { |
90 EXPECT_NE(0, error); | 90 EXPECT_NE(0, error); |
91 error_ = error; | 91 error_ = error; |
92 } | 92 } |
93 | 93 |
94 virtual bool Install(base::DictionaryValue* manifest, | 94 virtual bool Install(base::DictionaryValue* manifest, |
95 const FilePath& unpack_path) OVERRIDE { | 95 const FilePath& unpack_path) OVERRIDE { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 test_configurator()->SetLoopCount(1); | 397 test_configurator()->SetLoopCount(1); |
398 component_updater()->Start(); | 398 component_updater()->Start(); |
399 message_loop.Run(); | 399 message_loop.Run(); |
400 | 400 |
401 EXPECT_EQ(1, interceptor.GetHitCount()); | 401 EXPECT_EQ(1, interceptor.GetHitCount()); |
402 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); | 402 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error()); |
403 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); | 403 EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); |
404 | 404 |
405 component_updater()->Stop(); | 405 component_updater()->Stop(); |
406 } | 406 } |
OLD | NEW |