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

Side by Side Diff: chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm

Issue 10952016: Simplify the translate infobar code some. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/memory/scoped_nsobject.h" 7 #import "base/memory/scoped_nsobject.h"
8 #import "base/string_util.h" 8 #import "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #import "chrome/app/chrome_command_ids.h" // For translate menu command ids. 10 #import "chrome/app/chrome_command_ids.h" // For translate menu command ids.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 TranslateErrors::Type error, 47 TranslateErrors::Type error,
48 InfoBarTabHelper* infobar_helper, 48 InfoBarTabHelper* infobar_helper,
49 PrefService* prefs) 49 PrefService* prefs)
50 : TranslateInfoBarDelegate(type, error, infobar_helper, prefs, 50 : TranslateInfoBarDelegate(type, error, infobar_helper, prefs,
51 "en", "es") { 51 "en", "es") {
52 // Start out in the "Before Translate" state. 52 // Start out in the "Before Translate" state.
53 type_ = type; 53 type_ = type;
54 54
55 } 55 }
56 56
57 virtual string16 GetDisplayNameForLocale(const std::string& language_code) {
58 return ASCIIToUTF16("Foo");
59 }
60
61 virtual bool IsLanguageBlacklisted() {
62 return false;
63 }
64
65 virtual bool IsSiteBlacklisted() {
66 return false;
67 }
68
69 virtual bool ShouldAlwaysTranslate() {
70 return false;
71 }
72
73 MOCK_METHOD0(Translate, void()); 57 MOCK_METHOD0(Translate, void());
74 MOCK_METHOD0(RevertTranslation, void()); 58 MOCK_METHOD0(RevertTranslation, void());
59
75 MOCK_METHOD0(TranslationDeclined, void()); 60 MOCK_METHOD0(TranslationDeclined, void());
61
62 virtual bool IsLanguageBlacklisted() { return false; }
sail 2012/09/19 04:44:06 should these have OVERRIDE on them?
Peter Kasting 2012/09/19 04:53:32 Yes. Good catch.
76 MOCK_METHOD0(ToggleLanguageBlacklist, void()); 63 MOCK_METHOD0(ToggleLanguageBlacklist, void());
64 virtual bool IsSiteBlacklisted() { return false; }
77 MOCK_METHOD0(ToggleSiteBlacklist, void()); 65 MOCK_METHOD0(ToggleSiteBlacklist, void());
66 virtual bool ShouldAlwaysTranslate() { return false; }
78 MOCK_METHOD0(ToggleAlwaysTranslate, void()); 67 MOCK_METHOD0(ToggleAlwaysTranslate, void());
79 }; 68 };
80 69
81 class TranslationInfoBarTest : public CocoaProfileTest { 70 class TranslationInfoBarTest : public CocoaProfileTest {
82 public: 71 public:
83 // Each test gets a single Mock translate delegate for the lifetime of 72 // Each test gets a single Mock translate delegate for the lifetime of
84 // the test. 73 // the test.
85 virtual void SetUp() { 74 virtual void SetUp() {
86 CocoaProfileTest::SetUp(); 75 CocoaProfileTest::SetUp();
87 tab_contents_.reset( 76 tab_contents_.reset(
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 translate_prefs.IncrementTranslationDeniedCount("en"); 247 translate_prefs.IncrementTranslationDeniedCount("en");
259 } 248 }
260 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE); 249 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE);
261 BeforeTranslateInfobarController* controller = 250 BeforeTranslateInfobarController* controller =
262 (BeforeTranslateInfobarController*)infobar_controller_.get(); 251 (BeforeTranslateInfobarController*)infobar_controller_.get();
263 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); 252 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil);
264 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); 253 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil);
265 } 254 }
266 255
267 } // namespace 256 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698