| OLD | NEW |
| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" | 12 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
| 13 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_view.h" | 13 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_view.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
| 16 #include "components/autofill/core/browser/autofill_common_test.h" | 16 #include "components/autofill/core/browser/autofill_common_test.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
| 19 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
| 20 #include "content/public/test/web_contents_tester.h" | 20 #include "content/public/test/web_contents_tester.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "ui/base/range/range.h" | 22 #include "ui/gfx/range/range.h" |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 #include "ui/base/win/scoped_ole_initializer.h" | 25 #include "ui/base/win/scoped_ole_initializer.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace autofill { | 28 namespace autofill { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 base::string16 BackingCard() { | 32 base::string16 BackingCard() { |
| 33 return ASCIIToUTF16("Visa - 1111"); | 33 return ASCIIToUTF16("Visa - 1111"); |
| 34 } | 34 } |
| 35 | 35 |
| 36 base::string16 FrontingCard() { | 36 base::string16 FrontingCard() { |
| 37 return ASCIIToUTF16("Mastercard - 4444"); | 37 return ASCIIToUTF16("Mastercard - 4444"); |
| 38 } | 38 } |
| 39 | 39 |
| 40 base::string16 RangeOfString(const base::string16& string, | 40 base::string16 RangeOfString(const base::string16& string, |
| 41 const ui::Range& range) { | 41 const gfx::Range& range) { |
| 42 return string.substr(range.start(), range.end() - range.start()); | 42 return string.substr(range.start(), range.end() - range.start()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 class TestGeneratedCreditCardBubbleController | 45 class TestGeneratedCreditCardBubbleController |
| 46 : public GeneratedCreditCardBubbleController { | 46 : public GeneratedCreditCardBubbleController { |
| 47 public: | 47 public: |
| 48 explicit TestGeneratedCreditCardBubbleController( | 48 explicit TestGeneratedCreditCardBubbleController( |
| 49 content::WebContents* contents) | 49 content::WebContents* contents) |
| 50 : GeneratedCreditCardBubbleController(contents) { | 50 : GeneratedCreditCardBubbleController(contents) { |
| 51 contents->SetUserData(UserDataKey(), this); | 51 contents->SetUserData(UserDataKey(), this); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // If a page redirects right after submitting, the bubble should remain. | 205 // If a page redirects right after submitting, the bubble should remain. |
| 206 EXPECT_FALSE(controller()->GetTestingBubble()); | 206 EXPECT_FALSE(controller()->GetTestingBubble()); |
| 207 Show(); | 207 Show(); |
| 208 EXPECT_TRUE(controller()->GetTestingBubble()->showing()); | 208 EXPECT_TRUE(controller()->GetTestingBubble()->showing()); |
| 209 | 209 |
| 210 Redirect(); | 210 Redirect(); |
| 211 EXPECT_TRUE(controller()->GetTestingBubble()->showing()); | 211 EXPECT_TRUE(controller()->GetTestingBubble()->showing()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace autofill | 214 } // namespace autofill |
| OLD | NEW |