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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/passwords_bubble_controller_unittest.mm

Issue 2653733006: Remove the Finch experiment for the sign-in promo in the password bubble. (Closed)
Patch Set: fix mac/2 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.h" 5 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
11 #include "base/metrics/field_trial.h"
12 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
14 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 13 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
15 #include "chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h" 14 #include "chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h"
16 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h" 15 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h"
17 #import "chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller .h" 16 #import "chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller .h"
18 #import "chrome/browser/ui/cocoa/passwords/signin_promo_view_controller.h" 17 #import "chrome/browser/ui/cocoa/passwords/signin_promo_view_controller.h"
19 #import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controll er.h" 18 #import "chrome/browser/ui/cocoa/passwords/update_pending_password_view_controll er.h"
20 #include "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" 19 #include "chrome/browser/ui/cocoa/test/cocoa_test_helper.h"
21 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 20 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
22 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" 21 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
23 #include "components/password_manager/core/browser/password_bubble_experiment.h"
24 #include "components/variations/variations_associated_data.h"
25 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
26 #include "testing/gtest_mac.h" 23 #include "testing/gtest_mac.h"
27 #include "testing/platform_test.h" 24 #include "testing/platform_test.h"
28 25
29 namespace { 26 namespace {
30 27
31 using password_bubble_experiment::kChromeSignInPasswordPromoExperimentName;
32 using password_bubble_experiment::kChromeSignInPasswordPromoThresholdParam;
33
34 class ManagePasswordsBubbleControllerTest 28 class ManagePasswordsBubbleControllerTest
35 : public ManagePasswordsControllerTest { 29 : public ManagePasswordsControllerTest {
36 public: 30 public:
37 ManagePasswordsBubbleControllerTest() : controller_(nil) {} 31 ManagePasswordsBubbleControllerTest() : controller_(nil) {}
38 32
39 ManagePasswordsBubbleController* controller() { 33 ManagePasswordsBubbleController* controller() {
40 if (!controller_) { 34 if (!controller_) {
41 controller_ = [[ManagePasswordsBubbleController alloc] 35 controller_ = [[ManagePasswordsBubbleController alloc]
42 initWithParentWindow:browser()->window()->GetNativeWindow() 36 initWithParentWindow:browser()->window()->GetNativeWindow()
43 model:GetModelAndCreateIfNull()]; 37 model:GetModelAndCreateIfNull()];
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 81 }
88 82
89 TEST_F(ManagePasswordsBubbleControllerTest, ClearModelOnClose) { 83 TEST_F(ManagePasswordsBubbleControllerTest, ClearModelOnClose) {
90 SetUpUpdatePendingState(false); 84 SetUpUpdatePendingState(false);
91 EXPECT_TRUE(controller().model); 85 EXPECT_TRUE(controller().model);
92 [controller() close]; 86 [controller() close];
93 EXPECT_FALSE(controller().model); 87 EXPECT_FALSE(controller().model);
94 } 88 }
95 89
96 TEST_F(ManagePasswordsBubbleControllerTest, TransitionToSignInPromo) { 90 TEST_F(ManagePasswordsBubbleControllerTest, TransitionToSignInPromo) {
97 const char kFakeGroup[] = "FakeGroup";
98 base::FieldTrialList field_trial_list(nullptr);
99 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
100 kChromeSignInPasswordPromoExperimentName, kFakeGroup));
101 variations::AssociateVariationParams(
102 kChromeSignInPasswordPromoExperimentName, kFakeGroup,
103 {{kChromeSignInPasswordPromoThresholdParam, "3"}});
104
105 SetUpSavePendingState(false); 91 SetUpSavePendingState(false);
106 [controller() showWindow:nil]; 92 [controller() showWindow:nil];
107 SavePendingPasswordViewController* saveController = 93 SavePendingPasswordViewController* saveController =
108 base::mac::ObjCCastStrict<SavePendingPasswordViewController>( 94 base::mac::ObjCCastStrict<SavePendingPasswordViewController>(
109 [controller() currentController]); 95 [controller() currentController]);
110 EXPECT_TRUE(saveController.saveButton); 96 EXPECT_TRUE(saveController.saveButton);
111 [saveController.saveButton performClick:nil]; 97 [saveController.saveButton performClick:nil];
112 EXPECT_EQ([SignInPromoViewController class], 98 EXPECT_EQ([SignInPromoViewController class],
113 [[controller() currentController] class]); 99 [[controller() currentController] class]);
114 EXPECT_TRUE([[controller() window] isVisible]); 100 EXPECT_TRUE([[controller() window] isVisible]);
115
116 variations::testing::ClearAllVariationParams();
117 } 101 }
118 102
119 } // namespace 103 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698