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/mac/scoped_nsobject.h" |
8 #import "base/strings/string_util.h" | 8 #import "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/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. |
11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
12 #import "chrome/browser/translate/translate_infobar_delegate.h" | 12 #import "chrome/browser/translate/translate_infobar_delegate.h" |
13 #include "chrome/browser/translate/translate_language_list.h" | 13 #include "chrome/browser/translate/translate_language_list.h" |
14 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 14 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
15 #import "chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h" | 15 #import "chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h" |
16 #import "chrome/browser/ui/cocoa/infobars/infobar.h" | 16 #import "chrome/browser/ui/cocoa/infobars/infobar.h" |
17 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" | 17 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 infobar->controller())); | 100 infobar->controller())); |
101 // We need to set the window to be wide so that the options button | 101 // We need to set the window to be wide so that the options button |
102 // doesn't overlap the other buttons. | 102 // doesn't overlap the other buttons. |
103 [test_window() setContentSize:NSMakeSize(2000, 500)]; | 103 [test_window() setContentSize:NSMakeSize(2000, 500)]; |
104 [[infobar_controller_ view] setFrame:NSMakeRect(0, 0, 2000, 500)]; | 104 [[infobar_controller_ view] setFrame:NSMakeRect(0, 0, 2000, 500)]; |
105 [[test_window() contentView] addSubview:[infobar_controller_ view]]; | 105 [[test_window() contentView] addSubview:[infobar_controller_ view]]; |
106 } | 106 } |
107 | 107 |
108 scoped_ptr<WebContents> web_contents_; | 108 scoped_ptr<WebContents> web_contents_; |
109 scoped_ptr<MockTranslateInfoBarDelegate> infobar_delegate_; | 109 scoped_ptr<MockTranslateInfoBarDelegate> infobar_delegate_; |
110 scoped_nsobject<TranslateInfoBarControllerBase> infobar_controller_; | 110 base::scoped_nsobject<TranslateInfoBarControllerBase> infobar_controller_; |
111 }; | 111 }; |
112 | 112 |
113 // Check that we can instantiate a Translate Infobar correctly. | 113 // Check that we can instantiate a Translate Infobar correctly. |
114 TEST_F(TranslationInfoBarTest, Instantiate) { | 114 TEST_F(TranslationInfoBarTest, Instantiate) { |
115 CreateInfoBar(); | 115 CreateInfoBar(); |
116 ASSERT_TRUE(infobar_controller_.get()); | 116 ASSERT_TRUE(infobar_controller_.get()); |
117 } | 117 } |
118 | 118 |
119 // Check that clicking the Translate button calls Translate(). | 119 // Check that clicking the Translate button calls Translate(). |
120 TEST_F(TranslationInfoBarTest, TranslateCalledOnButtonPress) { | 120 TEST_F(TranslationInfoBarTest, TranslateCalledOnButtonPress) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 translate_prefs.IncrementTranslationDeniedCount("en"); | 246 translate_prefs.IncrementTranslationDeniedCount("en"); |
247 } | 247 } |
248 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE); | 248 CreateInfoBar(TranslateInfoBarDelegate::BEFORE_TRANSLATE); |
249 BeforeTranslateInfobarController* controller = | 249 BeforeTranslateInfobarController* controller = |
250 (BeforeTranslateInfobarController*)infobar_controller_.get(); | 250 (BeforeTranslateInfobarController*)infobar_controller_.get(); |
251 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); | 251 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); |
252 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); | 252 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); |
253 } | 253 } |
254 | 254 |
255 } // namespace | 255 } // namespace |
OLD | NEW |