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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" 5 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 AddTab(browser(), GURL("about:blank")); 57 AddTab(browser(), GURL("about:blank"));
58 TestSaveCardBubbleControllerImpl::CreateForTesting( 58 TestSaveCardBubbleControllerImpl::CreateForTesting(
59 browser()->tab_strip_model()->GetActiveWebContents()); 59 browser()->tab_strip_model()->GetActiveWebContents());
60 } 60 }
61 61
62 BrowserWindow* CreateBrowserWindow() override { 62 BrowserWindow* CreateBrowserWindow() override {
63 return new SaveCardBubbleTestBrowserWindow(); 63 return new SaveCardBubbleTestBrowserWindow();
64 } 64 }
65 65
66 void SetLegalMessage(const std::string& message_json) { 66 void SetLegalMessage(const std::string& message_json) {
67 scoped_ptr<base::Value> value(base::JSONReader::Read(message_json)); 67 std::unique_ptr<base::Value> value(base::JSONReader::Read(message_json));
68 ASSERT_TRUE(value); 68 ASSERT_TRUE(value);
69 base::DictionaryValue* dictionary; 69 base::DictionaryValue* dictionary;
70 ASSERT_TRUE(value->GetAsDictionary(&dictionary)); 70 ASSERT_TRUE(value->GetAsDictionary(&dictionary));
71 scoped_ptr<base::DictionaryValue> legal_message = 71 std::unique_ptr<base::DictionaryValue> legal_message =
72 dictionary->CreateDeepCopy(); 72 dictionary->CreateDeepCopy();
73 controller()->ShowBubbleForUpload(CreditCard(), std::move(legal_message), 73 controller()->ShowBubbleForUpload(CreditCard(), std::move(legal_message),
74 base::Bind(&SaveCardCallback)); 74 base::Bind(&SaveCardCallback));
75 } 75 }
76 76
77 void ShowLocalBubble() { 77 void ShowLocalBubble() {
78 controller()->ShowBubbleForLocalSave(CreditCard(), 78 controller()->ShowBubbleForLocalSave(CreditCard(),
79 base::Bind(&SaveCardCallback)); 79 base::Bind(&SaveCardCallback));
80 } 80 }
81 81
(...skipping 28 matching lines...) Expand all
110 SaveCardBubbleView* ShowSaveCreditCardBubble( 110 SaveCardBubbleView* ShowSaveCreditCardBubble(
111 content::WebContents* contents, 111 content::WebContents* contents,
112 SaveCardBubbleController* controller, 112 SaveCardBubbleController* controller,
113 bool user_gesture) override { 113 bool user_gesture) override {
114 if (!save_card_bubble_view_) 114 if (!save_card_bubble_view_)
115 save_card_bubble_view_.reset(new TestSaveCardBubbleView()); 115 save_card_bubble_view_.reset(new TestSaveCardBubbleView());
116 return save_card_bubble_view_.get(); 116 return save_card_bubble_view_.get();
117 } 117 }
118 118
119 private: 119 private:
120 scoped_ptr<TestSaveCardBubbleView> save_card_bubble_view_; 120 std::unique_ptr<TestSaveCardBubbleView> save_card_bubble_view_;
121 }; 121 };
122 122
123 static void SaveCardCallback() {} 123 static void SaveCardCallback() {}
124 124
125 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImplTest); 125 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImplTest);
126 }; 126 };
127 127
128 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_FirstShow_ShowBubble) { 128 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_FirstShow_ShowBubble) {
129 base::HistogramTester histogram_tester; 129 base::HistogramTester histogram_tester;
130 ShowLocalBubble(); 130 ShowLocalBubble();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 EXPECT_THAT( 355 EXPECT_THAT(
356 histogram_tester.GetAllSamples( 356 histogram_tester.GetAllSamples(
357 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), 357 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
358 ElementsAre( 358 ElementsAre(
359 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), 359 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
360 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, 360 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE,
361 1))); 361 1)));
362 } 362 }
363 363
364 } // namespace autofill 364 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698