Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / autofill / test_generated_credit_card_bubble_controller.cc
blob9c4b4f715247941e2a044a3b044b23b2b2358d3a
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.
5 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_controller.h"
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"
11 namespace autofill {
13 TestGeneratedCreditCardBubbleController::
14 TestGeneratedCreditCardBubbleController(content::WebContents* contents)
15 : GeneratedCreditCardBubbleController(contents),
16 bubbles_shown_(0) {
17 contents->SetUserData(UserDataKey(), this);
20 TestGeneratedCreditCardBubbleController::
21 ~TestGeneratedCreditCardBubbleController() {}
23 bool TestGeneratedCreditCardBubbleController::IsInstalled() const {
24 return web_contents()->GetUserData(UserDataKey()) == this;
27 TestGeneratedCreditCardBubbleView* TestGeneratedCreditCardBubbleController::
28 GetTestingBubble() {
29 return static_cast<TestGeneratedCreditCardBubbleView*>(
30 GeneratedCreditCardBubbleController::bubble().get());
33 base::WeakPtr<GeneratedCreditCardBubbleView>
34 TestGeneratedCreditCardBubbleController::CreateBubble() {
35 return TestGeneratedCreditCardBubbleView::Create(GetWeakPtr());
38 bool TestGeneratedCreditCardBubbleController::CanShow() const {
39 return true;
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_;
50 } // namespace autofill