OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/chromeos/cros/cros_library.h" | 5 #include "chrome/browser/chromeos/cros/cros_library.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/cros_library_loader.h" | 7 #include "chrome/browser/chromeos/cros/cros_library_loader.h" |
8 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 8 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
9 #include "chrome/browser/chromeos/cros/language_library.h" | 9 #include "chrome/browser/chromeos/cros/language_library.h" |
10 #include "chrome/browser/chromeos/cros/login_library.h" | 10 #include "chrome/browser/chromeos/cros/login_library.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return loaded_; | 107 return loaded_; |
108 } | 108 } |
109 | 109 |
110 CrosLibrary::TestApi* CrosLibrary::GetTestApi() { | 110 CrosLibrary::TestApi* CrosLibrary::GetTestApi() { |
111 if (!test_api_) | 111 if (!test_api_) |
112 test_api_ = new TestApi(this); | 112 test_api_ = new TestApi(this); |
113 return test_api_; | 113 return test_api_; |
114 } | 114 } |
115 | 115 |
116 void CrosLibrary::TestApi::SetLibraryLoader(LibraryLoader* loader) { | 116 void CrosLibrary::TestApi::SetLibraryLoader(LibraryLoader* loader) { |
| 117 if (library_->library_loader_ == loader) |
| 118 return; |
117 if (library_->library_loader_) | 119 if (library_->library_loader_) |
118 delete library_->library_loader_; | 120 delete library_->library_loader_; |
119 library_->library_loader_ = loader; | 121 library_->library_loader_ = loader; |
| 122 // Reset load flags when loader changes. Otherwise some tests are really not |
| 123 // going to be happy. |
| 124 library_->loaded_ = false; |
| 125 library_->load_error_ = false; |
120 } | 126 } |
121 | 127 |
122 void CrosLibrary::TestApi::SetCryptohomeLibrary(CryptohomeLibrary* library) { | 128 void CrosLibrary::TestApi::SetCryptohomeLibrary(CryptohomeLibrary* library) { |
123 if (library_->crypto_lib_) | 129 if (library_->crypto_lib_) |
124 delete library_->crypto_lib_; | 130 delete library_->crypto_lib_; |
125 library_->crypto_lib_ = library; | 131 library_->crypto_lib_ = library; |
126 } | 132 } |
127 | 133 |
128 void CrosLibrary::TestApi::SetLanguageLibrary(LanguageLibrary* library) { | 134 void CrosLibrary::TestApi::SetLanguageLibrary(LanguageLibrary* library) { |
129 if (library_->language_lib_) | 135 if (library_->language_lib_) |
(...skipping 26 matching lines...) Expand all Loading... |
156 } | 162 } |
157 | 163 |
158 void CrosLibrary::TestApi::SetSynapticsLibrary(SynapticsLibrary* library) { | 164 void CrosLibrary::TestApi::SetSynapticsLibrary(SynapticsLibrary* library) { |
159 if (library_->synaptics_lib_) | 165 if (library_->synaptics_lib_) |
160 delete library_->synaptics_lib_; | 166 delete library_->synaptics_lib_; |
161 library_->synaptics_lib_ = library; | 167 library_->synaptics_lib_ = library; |
162 } | 168 } |
163 | 169 |
164 } // end namespace. | 170 } // end namespace. |
165 | 171 |
OLD | NEW |