| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |