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

Side by Side Diff: chrome/browser/ui/autofill/generated_credit_card_bubble_controller_unittest.cc

Issue 1121083004: Revert of Classify navigations without page id in parallel to the existing classifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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 "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_controlle r.h" 13 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_controlle r.h"
14 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_view.h" 14 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_view.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "components/autofill/core/browser/autofill_test_utils.h" 17 #include "components/autofill/core/browser/autofill_test_utils.h"
18 #include "content/public/browser/navigation_details.h"
19 #include "content/public/browser/navigation_entry.h"
20 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
21 #include "content/public/test/test_browser_thread_bundle.h" 19 #include "content/public/test/test_browser_thread_bundle.h"
22 #include "content/public/test/web_contents_tester.h" 20 #include "content/public/test/web_contents_tester.h"
23 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
24 #include "ui/base/page_transition_types.h" 22 #include "ui/base/page_transition_types.h"
25 #include "ui/gfx/range/range.h" 23 #include "ui/gfx/range/range.h"
26 24
27 #if defined(OS_WIN) 25 #if defined(OS_WIN)
28 #include "ui/base/win/scoped_ole_initializer.h" 26 #include "ui/base/win/scoped_ole_initializer.h"
29 #endif 27 #endif
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ::prefs::kAutofillGeneratedCardBubbleTimesShown); 69 ::prefs::kAutofillGeneratedCardBubbleTimesShown);
72 } 70 }
73 71
74 void Show() { 72 void Show() {
75 ASSERT_TRUE(controller()->IsInstalled()); 73 ASSERT_TRUE(controller()->IsInstalled());
76 TestGeneratedCreditCardBubbleController::Show(test_web_contents_.get(), 74 TestGeneratedCreditCardBubbleController::Show(test_web_contents_.get(),
77 FrontingCard(), 75 FrontingCard(),
78 BackingCard()); 76 BackingCard());
79 } 77 }
80 78
81 void NavigateWithTransition(ui::PageTransition transition) { 79 void NavigateWithTransition(ui::PageTransition trans) {
82 content::LoadCommittedDetails details; 80 content::WebContentsTester::For(test_web_contents_.get())->TestDidNavigate(
83 content::FrameNavigateParams params; 81 test_web_contents_->GetMainFrame(), 1, GURL("about:blank"), trans);
84
85 // The transition is in two places; fill in both.
86 scoped_ptr<content::NavigationEntry> navigation_entry(
87 content::NavigationEntry::Create());
88 navigation_entry->SetTransitionType(transition);
89 params.transition = transition;
90 details.entry = navigation_entry.get();
91
92 ASSERT_NE(nullptr, controller());
93 controller()->DidNavigateMainFrame(details, params);
94 } 82 }
95 83
96 private: 84 private:
97 content::TestBrowserThreadBundle thread_bundle_; 85 content::TestBrowserThreadBundle thread_bundle_;
98 #if defined(OS_WIN) 86 #if defined(OS_WIN)
99 // Without this there will be drag and drop failures. http://crbug.com/227221 87 // Without this there will be drag and drop failures. http://crbug.com/227221
100 ui::ScopedOleInitializer ole_initializer_; 88 ui::ScopedOleInitializer ole_initializer_;
101 #endif 89 #endif
102 TestingProfile profile_; 90 TestingProfile profile_;
103 scoped_ptr<content::WebContents> test_web_contents_; 91 scoped_ptr<content::WebContents> test_web_contents_;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 167
180 // 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
181 // should stay showing. 169 // should stay showing.
182 NavigateWithTransition(ui::PAGE_TRANSITION_CLIENT_REDIRECT); 170 NavigateWithTransition(ui::PAGE_TRANSITION_CLIENT_REDIRECT);
183 NavigateWithTransition(ui::PAGE_TRANSITION_FORM_SUBMIT); 171 NavigateWithTransition(ui::PAGE_TRANSITION_FORM_SUBMIT);
184 NavigateWithTransition(ui::PAGE_TRANSITION_RELOAD); 172 NavigateWithTransition(ui::PAGE_TRANSITION_RELOAD);
185 EXPECT_TRUE(controller()->GetTestingBubble()->showing()); 173 EXPECT_TRUE(controller()->GetTestingBubble()->showing());
186 } 174 }
187 175
188 } // namespace autofill 176 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698