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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 15742018: Omit "Manage your X..." menu model items when user is new. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/guid.h" 5 #include "base/guid.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" 10 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 controller()->EditCancelledForSection(SECTION_EMAIL); 1397 controller()->EditCancelledForSection(SECTION_EMAIL);
1398 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome()); 1398 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome());
1399 1399
1400 controller()->MenuModelForSection(SECTION_EMAIL)->ActivatedAt(1); 1400 controller()->MenuModelForSection(SECTION_EMAIL)->ActivatedAt(1);
1401 EXPECT_TRUE(controller()->ShouldOfferToSaveInChrome()); 1401 EXPECT_TRUE(controller()->ShouldOfferToSaveInChrome());
1402 1402
1403 profile()->set_incognito(true); 1403 profile()->set_incognito(true);
1404 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome()); 1404 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome());
1405 } 1405 }
1406 1406
1407 TEST_F(AutofillDialogControllerTest, NoManageMenuItemForNewWalletUsers) {
1408 // Make sure the menu model item is created for a returning Wallet user.
1409 scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems();
1410 wallet_items->AddInstrument(wallet::GetTestMaskedInstrument());
1411 wallet_items->AddAddress(wallet::GetTestShippingAddress());
1412 controller()->OnDidGetWalletItems(wallet_items.Pass());
1413
1414 EXPECT_TRUE(controller()->MenuModelForSection(SECTION_CC_BILLING));
1415 // "Same as billing", "123 address", "Add address...", and "Manage addresses".
1416 EXPECT_EQ(
1417 4, controller()->MenuModelForSection(SECTION_SHIPPING)->GetItemCount());
1418
1419 // Make sure the menu model item is not created for new Wallet users.
1420 base::DictionaryValue dict;
1421 scoped_ptr<base::ListValue> required_actions(new base::ListValue);
1422 required_actions->AppendString("setup_wallet");
1423 dict.Set("required_action", required_actions.release());
1424 controller()->OnDidGetWalletItems(
1425 wallet::WalletItems::CreateWalletItems(dict).Pass());
1426
1427 EXPECT_FALSE(controller()->MenuModelForSection(SECTION_CC_BILLING));
1428 // "Same as billing" and "Add address...".
1429 EXPECT_EQ(
1430 2, controller()->MenuModelForSection(SECTION_SHIPPING)->GetItemCount());
1431 }
1432
1407 } // namespace autofill 1433 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698