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" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 return string.substr(range.start(), range.end() - range.start()); | 43 return string.substr(range.start(), range.end() - range.start()); |
44 } | 44 } |
45 | 45 |
46 class GeneratedCreditCardBubbleControllerTest : public testing::Test { | 46 class GeneratedCreditCardBubbleControllerTest : public testing::Test { |
47 public: | 47 public: |
48 GeneratedCreditCardBubbleControllerTest() | 48 GeneratedCreditCardBubbleControllerTest() |
49 : test_web_contents_( | 49 : test_web_contents_( |
50 content::WebContentsTester::CreateTestWebContents( | 50 content::WebContentsTester::CreateTestWebContents( |
51 &profile_, NULL)) {} | 51 &profile_, NULL)) {} |
52 | 52 |
53 virtual void SetUp() override { | 53 void SetUp() override { |
54 // Attaches immediately to |test_web_contents_| so a test version will exist | 54 // Attaches immediately to |test_web_contents_| so a test version will exist |
55 // before a non-test version can be created. | 55 // before a non-test version can be created. |
56 new TestGeneratedCreditCardBubbleController(test_web_contents_.get()); | 56 new TestGeneratedCreditCardBubbleController(test_web_contents_.get()); |
57 ASSERT_TRUE(controller()->IsInstalled()); | 57 ASSERT_TRUE(controller()->IsInstalled()); |
58 } | 58 } |
59 | 59 |
60 protected: | 60 protected: |
61 TestGeneratedCreditCardBubbleController* controller() { | 61 TestGeneratedCreditCardBubbleController* controller() { |
62 return static_cast<TestGeneratedCreditCardBubbleController*>( | 62 return static_cast<TestGeneratedCreditCardBubbleController*>( |
63 TestGeneratedCreditCardBubbleController::FromWebContents( | 63 TestGeneratedCreditCardBubbleController::FromWebContents( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 // If the user reloads or the page redirects or submits a form, the bubble | 168 // If the user reloads or the page redirects or submits a form, the bubble |
169 // should stay showing. | 169 // should stay showing. |
170 NavigateWithTransition(ui::PAGE_TRANSITION_CLIENT_REDIRECT); | 170 NavigateWithTransition(ui::PAGE_TRANSITION_CLIENT_REDIRECT); |
171 NavigateWithTransition(ui::PAGE_TRANSITION_FORM_SUBMIT); | 171 NavigateWithTransition(ui::PAGE_TRANSITION_FORM_SUBMIT); |
172 NavigateWithTransition(ui::PAGE_TRANSITION_RELOAD); | 172 NavigateWithTransition(ui::PAGE_TRANSITION_RELOAD); |
173 EXPECT_TRUE(controller()->GetTestingBubble()->showing()); | 173 EXPECT_TRUE(controller()->GetTestingBubble()->showing()); |
174 } | 174 } |
175 | 175 |
176 } // namespace autofill | 176 } // namespace autofill |
OLD | NEW |