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

Unified Diff: chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc

Issue 2661693002: Convert SaveCardBubbleControllerImpl to use the new navigation callbacks. (Closed)
Patch Set: fix test Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc b/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
index 95f7a046a9c20eab5774218adf99d32bd15d4589..9689355727f31bdfc495d4582a57f41668b0298f 100644
--- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
+++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
@@ -18,7 +18,7 @@
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/credit_card.h"
-#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -39,7 +39,13 @@ class TestSaveCardBubbleControllerImpl : public SaveCardBubbleControllerImpl {
void set_elapsed(base::TimeDelta elapsed) { elapsed_ = elapsed; }
- using SaveCardBubbleControllerImpl::DidNavigateMainFrame;
+ void SimulateNavigation() {
+ content::RenderFrameHost* rfh = web_contents()->GetMainFrame();
+ std::unique_ptr<content::NavigationHandle> navigation_handle =
+ content::NavigationHandle::CreateNavigationHandleForTesting(
+ GURL(), rfh, true);
+ // Destructor calls DidFinishNavigation.
+ }
protected:
base::TimeDelta Elapsed() const override { return elapsed_; }
@@ -239,8 +245,8 @@ TEST_F(SaveCardBubbleControllerImplTest,
base::HistogramTester histogram_tester;
// Fake-navigate after bubble has been visible for a long time.
controller()->set_elapsed(base::TimeDelta::FromMinutes(1));
- controller()->DidNavigateMainFrame(content::LoadCommittedDetails(),
- content::FrameNavigateParams());
+
+ controller()->SimulateNavigation();
histogram_tester.ExpectUniqueSample(
"Autofill.SaveCreditCardPrompt.Local.FirstShow",
@@ -255,8 +261,7 @@ TEST_F(SaveCardBubbleControllerImplTest,
base::HistogramTester histogram_tester;
// Fake-navigate after bubble has been visible for a long time.
controller()->set_elapsed(base::TimeDelta::FromMinutes(1));
- controller()->DidNavigateMainFrame(content::LoadCommittedDetails(),
- content::FrameNavigateParams());
+ controller()->SimulateNavigation();
histogram_tester.ExpectUniqueSample(
"Autofill.SaveCreditCardPrompt.Local.Reshows",
@@ -271,8 +276,7 @@ TEST_F(SaveCardBubbleControllerImplTest,
controller()->OnBubbleClosed();
// Fake-navigate after bubble has been visible for a long time.
controller()->set_elapsed(base::TimeDelta::FromMinutes(1));
- controller()->DidNavigateMainFrame(content::LoadCommittedDetails(),
- content::FrameNavigateParams());
+ controller()->SimulateNavigation();
histogram_tester.ExpectUniqueSample(
"Autofill.SaveCreditCardPrompt.Local.FirstShow",
@@ -288,8 +292,7 @@ TEST_F(SaveCardBubbleControllerImplTest,
controller()->OnBubbleClosed();
// Fake-navigate after bubble has been visible for a long time.
controller()->set_elapsed(base::TimeDelta::FromMinutes(1));
- controller()->DidNavigateMainFrame(content::LoadCommittedDetails(),
- content::FrameNavigateParams());
+ controller()->SimulateNavigation();
histogram_tester.ExpectUniqueSample(
"Autofill.SaveCreditCardPrompt.Local.Reshows",
« no previous file with comments | « chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698