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

Unified Diff: chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_controller_browsertest.mm

Issue 2625813003: MacViews: Allow the toolkit-views Enterprise Signin Confirmation Dialog to be used (Closed)
Patch Set: Rebase (DID NOT LAND) Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_controller_browsertest.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_controller_browsertest.mm b/chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_controller_browsertest.mm
index 6380427327b8719898c592ac26bf818b518b1cf0..4311f676cfe97f44e8b5c465d0c169a6c2a47c50 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_controller_browsertest.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_controller_browsertest.mm
@@ -18,10 +18,32 @@
#import "testing/gtest_mac.h"
#include "ui/base/l10n/l10n_util.h"
-class ProfileSigninConfirmationViewControllerTest
- : public InProcessBrowserTest,
- public ui::ProfileSigninConfirmationDelegate {
+@interface ProfileSigninConfirmationViewController (TestingAPI)
+
+@property(readonly, nonatomic) ui::ProfileSigninConfirmationDelegate* delegate;
+@property(readonly, nonatomic) NSButton* createProfileButton;
+@property(readonly, nonatomic) NSTextView* explanationField;
+
+@end
+
+@implementation ProfileSigninConfirmationViewController (TestingAPI)
+
+- (ui::ProfileSigninConfirmationDelegate*)delegate {
+ return delegate_.get();
+}
+
+- (NSButton*)createProfileButton {
+ return createProfileButton_.get();
+}
+- (NSTextView*)explanationField {
+ return explanationField_.get();
+}
+
+@end
+
+class ProfileSigninConfirmationViewControllerTest
+ : public InProcessBrowserTest {
public:
ProfileSigninConfirmationViewControllerTest()
: window_(nil),
@@ -44,11 +66,11 @@ class ProfileSigninConfirmationViewControllerTest
&ProfileSigninConfirmationViewControllerTest::OnClose,
base::Unretained(this));
controller_.reset([[ProfileSigninConfirmationViewController alloc]
- initWithBrowser:browser()
- username:username()
- delegate:this
- closeDialogCallback:close
- offerProfileCreation:offerProfileCreation]);
+ initWithBrowser:browser()
+ username:username()
+ delegate:base::MakeUnique<TestSigninDelegate>(this)
+ closeDialogCallback:close
+ offerProfileCreation:offerProfileCreation]);
[[window_ contentView] addSubview:[controller_ view]];
[window_ makeKeyAndOrderFront:NSApp];
ASSERT_TRUE([window_ isVisible]);
@@ -63,10 +85,6 @@ class ProfileSigninConfirmationViewControllerTest
IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE);
}
- // ui::ProfileSigninConfirmationDelegate:
- void OnContinueSignin() override { continued_ = true; }
- void OnCancelSignin() override { cancelled_ = true; }
- void OnSigninWithNewProfile() override { created_ = true; }
void OnClose() { closed_ = true; }
// The window containing the dialog.
@@ -82,6 +100,23 @@ class ProfileSigninConfirmationViewControllerTest
bool closed_;
private:
+ class TestSigninDelegate : public ui::ProfileSigninConfirmationDelegate {
+ public:
+ explicit TestSigninDelegate(
+ ProfileSigninConfirmationViewControllerTest* client)
+ : client_(client) {}
+
+ // ui::ProfileSigninConfirmationDelegate:
+ void OnContinueSignin() override { client_->continued_ = true; }
+ void OnCancelSignin() override { client_->cancelled_ = true; }
+ void OnSigninWithNewProfile() override { client_->created_ = true; }
+
+ private:
+ ProfileSigninConfirmationViewControllerTest* client_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestSigninDelegate);
+ };
+
DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationViewControllerTest);
};

Powered by Google App Engine
This is Rietveld 408576698