| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile_info_cache.h" | 5 #include "chrome/browser/profiles/profile_info_cache.h" |
| 6 | 6 |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/test/base/testing_browser_process_test.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/test/base/testing_browser_process.h" |
| 10 #include "chrome/test/base/testing_pref_service.h" | 11 #include "chrome/test/base/testing_pref_service.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| 17 class ProfileInfoCacheUnittests : public TestingBrowserProcessTest { | 19 class ProfileInfoCacheUnittests : public testing::Test { |
| 18 protected: | 20 protected: |
| 19 ProfileInfoCacheUnittests() : local_state_(testing_browser_process_.get()) { | 21 ProfileInfoCacheUnittests() |
| 22 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)) { |
| 20 cache_.reset(new ProfileInfoCache(local_state_.Get(), GetUserDataDir())); | 23 cache_.reset(new ProfileInfoCache(local_state_.Get(), GetUserDataDir())); |
| 21 } | 24 } |
| 22 | 25 |
| 23 FilePath GetUserDataDir() { | 26 FilePath GetUserDataDir() { |
| 24 return StringToFilePath("usr").Append(StringToFilePath("profile")); | 27 return StringToFilePath("usr").Append(StringToFilePath("profile")); |
| 25 } | 28 } |
| 26 | 29 |
| 27 FilePath StringToFilePath(std::string string_path) { | 30 FilePath StringToFilePath(std::string string_path) { |
| 28 #if defined(OS_POSIX) | 31 #if defined(OS_POSIX) |
| 29 return FilePath(string_path); | 32 return FilePath(string_path); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 EXPECT_EQ(new_name, cache_->GetNameOfProfileAtIndex(1)); | 94 EXPECT_EQ(new_name, cache_->GetNameOfProfileAtIndex(1)); |
| 92 EXPECT_NE(new_name, cache_->GetNameOfProfileAtIndex(0)); | 95 EXPECT_NE(new_name, cache_->GetNameOfProfileAtIndex(0)); |
| 93 | 96 |
| 94 size_t new_icon_index = 3; | 97 size_t new_icon_index = 3; |
| 95 cache_->SetAvatarIconOfProfileAtIndex(1, new_icon_index); | 98 cache_->SetAvatarIconOfProfileAtIndex(1, new_icon_index); |
| 96 // Not much to test. | 99 // Not much to test. |
| 97 cache_->GetAvatarIconOfProfileAtIndex(1); | 100 cache_->GetAvatarIconOfProfileAtIndex(1); |
| 98 } | 101 } |
| 99 | 102 |
| 100 } // namespace | 103 } // namespace |
| OLD | NEW |