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

Side by Side Diff: components/translate/core/browser/translate_manager_unittest.cc

Issue 2257793002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/translate/core/browser/translate_manager.h" 5 #include "components/translate/core/browser/translate_manager.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "base/test/scoped_feature_list.h" 10 #include "base/test/scoped_feature_list.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 MockTranslateClient(TranslateDriver* driver, PrefService* prefs) 86 MockTranslateClient(TranslateDriver* driver, PrefService* prefs)
87 : driver_(driver), prefs_(prefs) {} 87 : driver_(driver), prefs_(prefs) {}
88 88
89 // TODO(groby): Does TranslateClient need a virtual dtor? 89 // TODO(groby): Does TranslateClient need a virtual dtor?
90 virtual ~MockTranslateClient() {} 90 virtual ~MockTranslateClient() {}
91 91
92 TranslateDriver* GetTranslateDriver() { return driver_; } 92 TranslateDriver* GetTranslateDriver() { return driver_; }
93 PrefService* GetPrefs() { return prefs_; } 93 PrefService* GetPrefs() { return prefs_; }
94 94
95 std::unique_ptr<TranslatePrefs> GetTranslatePrefs() { 95 std::unique_ptr<TranslatePrefs> GetTranslatePrefs() {
96 return base::WrapUnique(new TranslatePrefs(prefs_, kAcceptLanguages, 96 return base::MakeUnique<TranslatePrefs>(prefs_, kAcceptLanguages,
97 kLanguagePreferredLanguages)); 97 kLanguagePreferredLanguages);
98 } 98 }
99 MOCK_METHOD0(GetTranslateAcceptLanguages, TranslateAcceptLanguages*()); 99 MOCK_METHOD0(GetTranslateAcceptLanguages, TranslateAcceptLanguages*());
100 MOCK_CONST_METHOD0(GetInfobarIconID, int()); 100 MOCK_CONST_METHOD0(GetInfobarIconID, int());
101 101
102 #if !defined(USE_AURA) 102 #if !defined(USE_AURA)
103 MOCK_CONST_METHOD1(CreateInfoBarMock, 103 MOCK_CONST_METHOD1(CreateInfoBarMock,
104 infobars::InfoBar*(TranslateInfoBarDelegate*)); 104 infobars::InfoBar*(TranslateInfoBarDelegate*));
105 std::unique_ptr<infobars::InfoBar> CreateInfoBar( 105 std::unique_ptr<infobars::InfoBar> CreateInfoBar(
106 std::unique_ptr<TranslateInfoBarDelegate> delegate) const { 106 std::unique_ptr<TranslateInfoBarDelegate> delegate) const {
107 return base::WrapUnique(CreateInfoBarMock(std::move(delegate).get())); 107 return base::WrapUnique(CreateInfoBarMock(std::move(delegate).get()));
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // 0.79 and lower than 0.8 and the probability threshold is lower than both 444 // 0.79 and lower than 0.8 and the probability threshold is lower than both
445 // the one with "fr" (0.6) and "pt-PT" (0.4). 445 // the one with "fr" (0.6) and "pt-PT" (0.4).
446 EXPECT_TRUE(CallLanguageInULP("fr")); 446 EXPECT_TRUE(CallLanguageInULP("fr"));
447 EXPECT_TRUE(CallLanguageInULP("pt")); 447 EXPECT_TRUE(CallLanguageInULP("pt"));
448 EXPECT_FALSE(CallLanguageInULP("zh-TW")); 448 EXPECT_FALSE(CallLanguageInULP("zh-TW"));
449 } 449 }
450 450
451 } // namespace testing 451 } // namespace testing
452 452
453 } // namespace translate 453 } // namespace translate
OLDNEW
« no previous file with comments | « components/test_runner/web_test_interfaces.cc ('k') | components/translate/core/browser/translate_ui_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698