- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / autofill / test_generated_credit_card_bubble_controller.cc
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_controller.h"
6
7 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_view.h"
8 #include "content/public/browser/web_contents.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace autofill {
12
13 TestGeneratedCreditCardBubbleController::
14     TestGeneratedCreditCardBubbleController(content::WebContents* contents)
15     : GeneratedCreditCardBubbleController(contents),
16       bubbles_shown_(0) {
17   contents->SetUserData(UserDataKey(), this);
18 }
19
20 TestGeneratedCreditCardBubbleController::
21     ~TestGeneratedCreditCardBubbleController() {}
22
23 bool TestGeneratedCreditCardBubbleController::IsInstalled() const {
24   return web_contents()->GetUserData(UserDataKey()) == this;
25 }
26
27 TestGeneratedCreditCardBubbleView* TestGeneratedCreditCardBubbleController::
28     GetTestingBubble() {
29   return static_cast<TestGeneratedCreditCardBubbleView*>(
30       GeneratedCreditCardBubbleController::bubble().get());
31 }
32
33 base::WeakPtr<GeneratedCreditCardBubbleView>
34     TestGeneratedCreditCardBubbleController::CreateBubble() {
35   return TestGeneratedCreditCardBubbleView::Create(GetWeakPtr());
36 }
37
38 bool TestGeneratedCreditCardBubbleController::CanShow() const {
39   return true;
40 }
41
42 void TestGeneratedCreditCardBubbleController::SetupAndShow(
43     const base::string16& fronting_card_name,
44     const base::string16& backing_card_name) {
45   GeneratedCreditCardBubbleController::SetupAndShow(fronting_card_name,
46                                                     backing_card_name);
47   ++bubbles_shown_;
48 }
49
50 }  // namespace autofill