#include "base/memory/scoped_ptr.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/bookmarks/bookmark_test_helpers.h"
-#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/signin/fake_signin_manager.h"
-#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h"
#include "chrome/test/base/browser_with_test_window_test.h"
+#include "components/bookmarks/core/browser/bookmark_utils.h"
+#include "components/bookmarks/core/test/bookmark_test_helpers.h"
+#include "components/signin/core/browser/signin_manager.h"
namespace {
const char kTestBookmarkURL[] = "http://www.google.com";
BrowserWithTestWindowTest::SetUp();
profile()->CreateBookmarkModel(true);
- test::WaitForBookmarkModelToLoad(profile());
+ BookmarkModel* bookmark_model =
+ BookmarkModelFactory::GetForProfile(profile());
+ test::WaitForBookmarkModelToLoad(bookmark_model);
bookmark_utils::AddIfNotBookmarked(
- BookmarkModelFactory::GetForProfile(profile()),
- GURL(kTestBookmarkURL),
- base::string16());
+ bookmark_model, GURL(kTestBookmarkURL), base::string16());
}
virtual void TearDown() OVERRIDE {
BrowserWithTestWindowTest::TearDown();
}
+ // BrowserWithTestWindowTest:
+ virtual TestingProfile* CreateProfile() OVERRIDE {
+ TestingProfile::Builder builder;
+ builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
+ FakeSigninManagerBase::Build);
+ return builder.Build().release();
+ }
+
protected:
// Creates a bookmark bubble view.
void CreateBubbleView() {
true));
}
- void CreateSigninManager(const std::string& username) {
- SigninManagerBase* signin_manager =
- static_cast<SigninManagerBase*>(
- SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse(
- profile(),
- &BookmarkBubbleViewTest::BuildFakeSignInManager));
- signin_manager->Initialize(profile(), NULL);
-
- if (!username.empty()) {
- ASSERT_TRUE(signin_manager);
- signin_manager->SetAuthenticatedUsername(username);
- }
+ void SetUpSigninManager(const std::string& username) {
+ if (username.empty())
+ return;
+ SigninManagerBase* signin_manager = static_cast<SigninManagerBase*>(
+ SigninManagerFactory::GetForProfile(profile()));
+ ASSERT_TRUE(signin_manager);
+ signin_manager->SetAuthenticatedUsername(username);
}
scoped_ptr<BookmarkBubbleView> bubble_;
private:
- static BrowserContextKeyedService* BuildFakeSignInManager(
- content::BrowserContext* profile) {
-#if defined(OS_CHROMEOS)
- return new FakeSigninManagerBase();
-#else // !defined(OS_CHROMEOS)
- return new FakeSigninManager(static_cast<Profile*>(profile));
-#endif
- }
-
DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleViewTest);
};
// Verifies that the sync promo is not displayed for a signed in user.
TEST_F(BookmarkBubbleViewTest, SyncPromoSignedIn) {
- CreateSigninManager("fake_username");
+ SetUpSigninManager("fake_username");
CreateBubbleView();
bubble_->Init();
EXPECT_FALSE(bubble_->sync_promo_view_);