| Index: chrome/browser/ui/views/bookmarks/bookmark_bubble_view_browsertest.cc
|
| diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_browsertest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_browsertest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5d3834e265a309e39e5cccaf43fa0c0ed400c446
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_browsertest.cc
|
| @@ -0,0 +1,66 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/command_line.h"
|
| +#include "chrome/browser/bookmarks/bookmark_model_factory.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/browser.h"
|
| +#include "chrome/browser/ui/browser_window.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| +#include "chrome/test/base/in_process_browser_test.h"
|
| +#include "chrome/test/base/ui_test_utils.h"
|
| +
|
| +namespace {
|
| +const char kTestBookmarkURL[] = "http://www.google.com";
|
| +} // namespace
|
| +
|
| +class BookmarkBubbleViewBrowserTest : public InProcessBrowserTest {
|
| + public:
|
| + BookmarkBubbleViewBrowserTest() {}
|
| +
|
| + // content::BrowserTestBase:
|
| + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
|
| + command_line->AppendSwitch(switches::kEnableBookmarkSyncPromo);
|
| + }
|
| +
|
| + virtual void SetUpOnMainThread() OVERRIDE {
|
| + bookmark_utils::AddIfNotBookmarked(
|
| + BookmarkModelFactory::GetForProfile(browser()->profile()),
|
| + GURL(kTestBookmarkURL),
|
| + string16());
|
| + }
|
| +
|
| + protected:
|
| + void ShowBookmarkBubble() {
|
| + browser()->window()->ShowBookmarkBubble(GURL(kTestBookmarkURL), true);
|
| + }
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleViewBrowserTest);
|
| +};
|
| +
|
| +// Verifies that the sync promo is not displayed for a signed in user.
|
| +IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, SyncPromoSignedIn) {
|
| + SigninManager* signin = SigninManagerFactory::GetForProfile(
|
| + browser()->profile());
|
| + signin->SetAuthenticatedUsername("fake_username");
|
| +
|
| + ShowBookmarkBubble();
|
| + ASSERT_TRUE(BookmarkBubbleView::IsShowing());
|
| + EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble_->sync_promo_view_);
|
| +}
|
| +
|
| +// Verifies that the sync promo is displayed for a user that is not signed in.
|
| +IN_PROC_BROWSER_TEST_F(BookmarkBubbleViewBrowserTest, SyncPromoNotSignedIn) {
|
| + ShowBookmarkBubble();
|
| + ASSERT_TRUE(BookmarkBubbleView::IsShowing());
|
| + EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble_->sync_promo_view_);
|
| +}
|
|
|