| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_contr
oller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_contr
oller.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public: | 24 public: |
| 25 ProfileSigninConfirmationViewControllerTest() | 25 ProfileSigninConfirmationViewControllerTest() |
| 26 : window_(nil), | 26 : window_(nil), |
| 27 continued_(false), | 27 continued_(false), |
| 28 cancelled_(false), | 28 cancelled_(false), |
| 29 created_(false), | 29 created_(false), |
| 30 closed_(false) { | 30 closed_(false) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 virtual void SetUpOnMainThread() override { | 34 void SetUpOnMainThread() override {} |
| 35 } | |
| 36 | 35 |
| 37 void SetupDialog(bool offerProfileCreation = true) { | 36 void SetupDialog(bool offerProfileCreation = true) { |
| 38 window_.reset( | 37 window_.reset( |
| 39 [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 400, 600) | 38 [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 400, 600) |
| 40 styleMask:NSBorderlessWindowMask | 39 styleMask:NSBorderlessWindowMask |
| 41 backing:NSBackingStoreBuffered | 40 backing:NSBackingStoreBuffered |
| 42 defer:NO]); | 41 defer:NO]); |
| 43 base::Closure close = base::Bind( | 42 base::Closure close = base::Bind( |
| 44 &ProfileSigninConfirmationViewControllerTest::OnClose, this); | 43 &ProfileSigninConfirmationViewControllerTest::OnClose, this); |
| 45 controller_.reset([[ProfileSigninConfirmationViewController alloc] | 44 controller_.reset([[ProfileSigninConfirmationViewController alloc] |
| (...skipping 10 matching lines...) Expand all Loading... |
| 56 // Test helpers. | 55 // Test helpers. |
| 57 std::string username() { | 56 std::string username() { |
| 58 return "foo@bar.com"; | 57 return "foo@bar.com"; |
| 59 } | 58 } |
| 60 base::string16 learn_more() { | 59 base::string16 learn_more() { |
| 61 return l10n_util::GetStringUTF16( | 60 return l10n_util::GetStringUTF16( |
| 62 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); | 61 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); |
| 63 } | 62 } |
| 64 | 63 |
| 65 // ui::ProfileSigninConfirmationDelegate: | 64 // ui::ProfileSigninConfirmationDelegate: |
| 66 virtual void OnContinueSignin() override { continued_ = true; } | 65 void OnContinueSignin() override { continued_ = true; } |
| 67 virtual void OnCancelSignin() override { cancelled_ = true; } | 66 void OnCancelSignin() override { cancelled_ = true; } |
| 68 virtual void OnSigninWithNewProfile() override { created_ = true; } | 67 void OnSigninWithNewProfile() override { created_ = true; } |
| 69 void OnClose() { closed_ = true; } | 68 void OnClose() { closed_ = true; } |
| 70 | 69 |
| 71 // The window containing the dialog. | 70 // The window containing the dialog. |
| 72 base::scoped_nsobject<NSWindow> window_; | 71 base::scoped_nsobject<NSWindow> window_; |
| 73 | 72 |
| 74 // Dialog under test. | 73 // Dialog under test. |
| 75 base::scoped_nsobject<ProfileSigninConfirmationViewController> controller_; | 74 base::scoped_nsobject<ProfileSigninConfirmationViewController> controller_; |
| 76 | 75 |
| 77 // Visible for testing UI interactions. | 76 // Visible for testing UI interactions. |
| 78 bool continued_; | 77 bool continued_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 EXPECT_NSNE(nil, [controller_ createProfileButton]); | 176 EXPECT_NSNE(nil, [controller_ createProfileButton]); |
| 178 EXPECT_TRUE([[[controller_ view] subviews] | 177 EXPECT_TRUE([[[controller_ view] subviews] |
| 179 containsObject:[controller_ createProfileButton]]); | 178 containsObject:[controller_ createProfileButton]]); |
| 180 NSString* explanationWithCreateProfile = base::SysUTF16ToNSString( | 179 NSString* explanationWithCreateProfile = base::SysUTF16ToNSString( |
| 181 l10n_util::GetStringFUTF16( | 180 l10n_util::GetStringFUTF16( |
| 182 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION_NEW_STYLE, | 181 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION_NEW_STYLE, |
| 183 base::UTF8ToUTF16(username()), learn_more())); | 182 base::UTF8ToUTF16(username()), learn_more())); |
| 184 EXPECT_NSEQ(explanationWithCreateProfile, | 183 EXPECT_NSEQ(explanationWithCreateProfile, |
| 185 [[[controller_ explanationField] textStorage] string]); | 184 [[[controller_ explanationField] textStorage] string]); |
| 186 } | 185 } |
| OLD | NEW |