OLD | NEW |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 MOCK_METHOD0(ToggleAlwaysTranslate, void()); | 69 MOCK_METHOD0(ToggleAlwaysTranslate, void()); |
70 }; | 70 }; |
71 | 71 |
72 class TranslationInfoBarTest : public CocoaProfileTest { | 72 class TranslationInfoBarTest : public CocoaProfileTest { |
73 public: | 73 public: |
74 // Each test gets a single Mock translate delegate for the lifetime of | 74 // Each test gets a single Mock translate delegate for the lifetime of |
75 // the test. | 75 // the test. |
76 virtual void SetUp() { | 76 virtual void SetUp() { |
77 CocoaProfileTest::SetUp(); | 77 CocoaProfileTest::SetUp(); |
78 tab_contents_.reset(new TabContents(WebContents::Create( | 78 tab_contents_.reset(new TabContents(WebContents::Create( |
79 profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); | 79 profile(), NULL, MSG_ROUTING_NONE, NULL))); |
80 CreateInfoBar(); | 80 CreateInfoBar(); |
81 } | 81 } |
82 | 82 |
83 void CreateInfoBar() { | 83 void CreateInfoBar() { |
84 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE); | 84 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE); |
85 } | 85 } |
86 | 86 |
87 void CreateInfoBar(TranslateInfoBarDelegate::Type type) { | 87 void CreateInfoBar(TranslateInfoBarDelegate::Type type) { |
88 TranslateErrors::Type error = TranslateErrors::NONE; | 88 TranslateErrors::Type error = TranslateErrors::NONE; |
89 if (type == TranslateInfoBarDelegate::TRANSLATION_ERROR) | 89 if (type == TranslateInfoBarDelegate::TRANSLATION_ERROR) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 translate_prefs.IncrementTranslationDeniedCount("en"); | 248 translate_prefs.IncrementTranslationDeniedCount("en"); |
249 } | 249 } |
250 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE); | 250 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE); |
251 BeforeTranslateInfobarController* controller = | 251 BeforeTranslateInfobarController* controller = |
252 (BeforeTranslateInfobarController*)infobar_controller_.get(); | 252 (BeforeTranslateInfobarController*)infobar_controller_.get(); |
253 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); | 253 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); |
254 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); | 254 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); |
255 } | 255 } |
256 | 256 |
257 } // namespace | 257 } // namespace |
OLD | NEW |