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

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

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac Created 6 years, 8 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/mac/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.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 TranslateErrors::Type error = TranslateErrors::NONE; 92 TranslateErrors::Type error = TranslateErrors::NONE;
93 if (type == translate::TRANSLATE_STEP_TRANSLATE_ERROR) 93 if (type == translate::TRANSLATE_STEP_TRANSLATE_ERROR)
94 error = TranslateErrors::NETWORK; 94 error = TranslateErrors::NETWORK;
95 Profile* profile = 95 Profile* profile =
96 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 96 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
97 [[infobar_controller_ view] removeFromSuperview]; 97 [[infobar_controller_ view] removeFromSuperview];
98 98
99 scoped_ptr<TranslateInfoBarDelegate> delegate( 99 scoped_ptr<TranslateInfoBarDelegate> delegate(
100 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error, 100 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error,
101 profile->GetPrefs())); 101 profile->GetPrefs()));
102 scoped_ptr<InfoBar> infobar( 102 scoped_ptr<infobars::InfoBar> infobar(
103 TranslateInfoBarDelegate::CreateInfoBar(delegate.Pass())); 103 TranslateInfoBarDelegate::CreateInfoBar(delegate.Pass()));
104 if (infobar_) 104 if (infobar_)
105 infobar_->CloseSoon(); 105 infobar_->CloseSoon();
106 infobar_ = static_cast<InfoBarCocoa*>(infobar.release()); 106 infobar_ = static_cast<InfoBarCocoa*>(infobar.release());
107 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get())); 107 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get()));
108 108
109 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>( 109 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>(
110 infobar_->controller()) retain]); 110 infobar_->controller()) retain]);
111 111
112 // We need to set the window to be wide so that the options button 112 // We need to set the window to be wide so that the options button
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 translate_prefs->ResetTranslationDeniedCount("en"); 261 translate_prefs->ResetTranslationDeniedCount("en");
262 for (int i = 0; i < 4; ++i) { 262 for (int i = 0; i < 4; ++i) {
263 translate_prefs->IncrementTranslationDeniedCount("en"); 263 translate_prefs->IncrementTranslationDeniedCount("en");
264 } 264 }
265 CreateInfoBar(translate::TRANSLATE_STEP_BEFORE_TRANSLATE); 265 CreateInfoBar(translate::TRANSLATE_STEP_BEFORE_TRANSLATE);
266 BeforeTranslateInfobarController* controller = 266 BeforeTranslateInfobarController* controller =
267 (BeforeTranslateInfobarController*)infobar_controller_.get(); 267 (BeforeTranslateInfobarController*)infobar_controller_.get();
268 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); 268 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil);
269 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); 269 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil);
270 } 270 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/translate_infobar_base.mm ('k') | chrome/browser/ui/cocoa/keystone_infobar_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698