Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view_unittest.cc

Issue 1407093007: Autofill: Add legal message footer to save credit card bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/views/bookmarks/bookmark_sync_promo_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" 11 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
13 #include "ui/gfx/range/range.h" 14 #include "ui/gfx/range/range.h"
15 #include "ui/views/controls/styled_label.h"
14 16
15 class BookmarkSyncPromoViewTest : public BookmarkBubbleDelegate, 17 class BookmarkSyncPromoViewTest : public BookmarkBubbleDelegate,
16 public testing::Test { 18 public testing::Test {
17 public: 19 public:
18 BookmarkSyncPromoViewTest() : sign_in_clicked_count_(0) {} 20 BookmarkSyncPromoViewTest() : sign_in_clicked_count_(0) {}
19 21
20 protected: 22 protected:
21 // BookmarkBubbleDelegate: 23 // BookmarkBubbleDelegate:
22 void OnSignInLinkClicked() override { ++sign_in_clicked_count_; } 24 void OnSignInLinkClicked() override { ++sign_in_clicked_count_; }
23 25
24 // Number of times that OnSignInLinkClicked has been called. 26 // Number of times that OnSignInLinkClicked has been called.
25 int sign_in_clicked_count_; 27 int sign_in_clicked_count_;
26 28
27 private: 29 private:
28 DISALLOW_COPY_AND_ASSIGN(BookmarkSyncPromoViewTest); 30 DISALLOW_COPY_AND_ASSIGN(BookmarkSyncPromoViewTest);
29 }; 31 };
30 32
31 TEST_F(BookmarkSyncPromoViewTest, SignInLink) { 33 TEST_F(BookmarkSyncPromoViewTest, SignInLink) {
32 scoped_ptr<BookmarkSyncPromoView> sync_promo; 34 scoped_ptr<BookmarkSyncPromoView> sync_promo;
33 sync_promo.reset(new BookmarkSyncPromoView(this)); 35 sync_promo.reset(new BookmarkSyncPromoView(this));
34 36
35 // Simulate clicking the "Sign in" link. 37 // Simulate clicking the "Sign in" link.
38 views::StyledLabel styled_label(base::ASCIIToUTF16("test"), nullptr);
36 views::StyledLabelListener* listener = sync_promo.get(); 39 views::StyledLabelListener* listener = sync_promo.get();
37 listener->StyledLabelLinkClicked(gfx::Range(), ui::EF_NONE); 40 listener->StyledLabelLinkClicked(&styled_label, gfx::Range(), ui::EF_NONE);
38 41
39 EXPECT_EQ(1, sign_in_clicked_count_); 42 EXPECT_EQ(1, sign_in_clicked_count_);
40 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698