diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 01:29:46 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 01:29:46 +0000 |
commit | 232a9cefa38930558d310702e4b4e5e5f2c90c2b (patch) | |
tree | e4c8c98d6c44118c0a395f676afa6396e40947cd /chrome/browser | |
parent | bbeae2e4e1597bc01988f00fee4139f4202a209f (diff) | |
download | chromium_src-232a9cefa38930558d310702e4b4e5e5f2c90c2b.zip chromium_src-232a9cefa38930558d310702e4b4e5e5f2c90c2b.tar.gz chromium_src-232a9cefa38930558d310702e4b4e5e5f2c90c2b.tar.bz2 |
Fixed loader issue in unit tests caused by some test not using that mock and causing the library to appear already loaded in a failed state.
Review URL: http://codereview.chromium.org/1251001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/chromeos/cros/cros_library.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/google_authenticator_unittest.cc | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/cros/cros_library.cc b/chrome/browser/chromeos/cros/cros_library.cc index 3a06a54..71a7f4d 100644 --- a/chrome/browser/chromeos/cros/cros_library.cc +++ b/chrome/browser/chromeos/cros/cros_library.cc @@ -114,9 +114,15 @@ CrosLibrary::TestApi* CrosLibrary::GetTestApi() { } void CrosLibrary::TestApi::SetLibraryLoader(LibraryLoader* loader) { + if (library_->library_loader_ == loader) + return; if (library_->library_loader_) delete library_->library_loader_; library_->library_loader_ = loader; + // Reset load flags when loader changes. Otherwise some tests are really not + // going to be happy. + library_->loaded_ = false; + library_->load_error_ = false; } void CrosLibrary::TestApi::SetCryptohomeLibrary(CryptohomeLibrary* library) { diff --git a/chrome/browser/chromeos/login/google_authenticator_unittest.cc b/chrome/browser/chromeos/login/google_authenticator_unittest.cc index 89cddc6..8139abd 100644 --- a/chrome/browser/chromeos/login/google_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/google_authenticator_unittest.cc @@ -67,6 +67,11 @@ class GoogleAuthenticatorTest : public ::testing::Test { // Tears down the test fixture. virtual void TearDown() { + // Prevent bogus gMock leak check from firing. + chromeos::CrosLibrary::TestApi* test_api = + chromeos::CrosLibrary::Get()->GetTestApi(); + test_api->SetLibraryLoader(NULL); + test_api->SetCryptohomeLibrary(NULL); } unsigned char fake_hash_[32]; |