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

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

Issue 1579863003: Convert Pass()→std::move() for Mac build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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 #include <stddef.h> 6 #include <stddef.h>
7 7
8 #include <utility>
9
8 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #import "base/strings/string_util.h" 12 #import "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/infobars/infobar_service.h" 14 #include "chrome/browser/infobars/infobar_service.h"
13 #import "chrome/browser/translate/chrome_translate_client.h" 15 #import "chrome/browser/translate/chrome_translate_client.h"
14 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 16 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
15 #import "chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h" 17 #import "chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h"
16 #import "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" 18 #import "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h"
17 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" 19 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 translate::TranslateErrors::Type error = translate::TranslateErrors::NONE; 99 translate::TranslateErrors::Type error = translate::TranslateErrors::NONE;
98 if (type == translate::TRANSLATE_STEP_TRANSLATE_ERROR) 100 if (type == translate::TRANSLATE_STEP_TRANSLATE_ERROR)
99 error = translate::TranslateErrors::NETWORK; 101 error = translate::TranslateErrors::NETWORK;
100 [[infobar_controller_ view] removeFromSuperview]; 102 [[infobar_controller_ view] removeFromSuperview];
101 103
102 ChromeTranslateClient* chrome_translate_client = 104 ChromeTranslateClient* chrome_translate_client =
103 ChromeTranslateClient::FromWebContents(web_contents_.get()); 105 ChromeTranslateClient::FromWebContents(web_contents_.get());
104 scoped_ptr<translate::TranslateInfoBarDelegate> delegate( 106 scoped_ptr<translate::TranslateInfoBarDelegate> delegate(
105 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error)); 107 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error));
106 scoped_ptr<infobars::InfoBar> infobar( 108 scoped_ptr<infobars::InfoBar> infobar(
107 chrome_translate_client->CreateInfoBar(delegate.Pass())); 109 chrome_translate_client->CreateInfoBar(std::move(delegate)));
108 if (infobar_) 110 if (infobar_)
109 infobar_->CloseSoon(); 111 infobar_->CloseSoon();
110 infobar_ = static_cast<InfoBarCocoa*>(infobar.release()); 112 infobar_ = static_cast<InfoBarCocoa*>(infobar.release());
111 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get())); 113 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get()));
112 114
113 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>( 115 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>(
114 infobar_->controller()) retain]); 116 infobar_->controller()) retain]);
115 117
116 // We need to set the window to be wide so that the options button 118 // We need to set the window to be wide so that the options button
117 // doesn't overlap the other buttons. 119 // doesn't overlap the other buttons.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 translate_prefs->ResetTranslationDeniedCount("en"); 270 translate_prefs->ResetTranslationDeniedCount("en");
269 for (int i = 0; i < 4; ++i) { 271 for (int i = 0; i < 4; ++i) {
270 translate_prefs->IncrementTranslationDeniedCount("en"); 272 translate_prefs->IncrementTranslationDeniedCount("en");
271 } 273 }
272 CreateInfoBar(translate::TRANSLATE_STEP_BEFORE_TRANSLATE); 274 CreateInfoBar(translate::TRANSLATE_STEP_BEFORE_TRANSLATE);
273 BeforeTranslateInfobarController* controller = 275 BeforeTranslateInfobarController* controller =
274 (BeforeTranslateInfobarController*)infobar_controller_.get(); 276 (BeforeTranslateInfobarController*)infobar_controller_.get();
275 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); 277 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil);
276 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); 278 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil);
277 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698