Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1305 controller()->EditCancelledForSection(SECTION_EMAIL); | 1305 controller()->EditCancelledForSection(SECTION_EMAIL); |
| 1306 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome()); | 1306 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome()); |
| 1307 | 1307 |
| 1308 controller()->MenuModelForSection(SECTION_EMAIL)->ActivatedAt(1); | 1308 controller()->MenuModelForSection(SECTION_EMAIL)->ActivatedAt(1); |
| 1309 EXPECT_TRUE(controller()->ShouldOfferToSaveInChrome()); | 1309 EXPECT_TRUE(controller()->ShouldOfferToSaveInChrome()); |
| 1310 | 1310 |
| 1311 profile()->set_incognito(true); | 1311 profile()->set_incognito(true); |
| 1312 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome()); | 1312 EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome()); |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 TEST_F(AutofillDialogControllerTest, NoManageMenuItemForNewWalletUsers) { | |
| 1316 // Make sure the menu model item is created when desired. | |
|
Evan Stade
2013/05/23 16:32:12
s/when desired/for a returning Wallet user.
Dan Beam
2013/05/23 19:31:16
Done.
| |
| 1317 scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems(); | |
| 1318 wallet_items->AddInstrument(wallet::GetTestMaskedInstrument()); | |
| 1319 wallet_items->AddAddress(wallet::GetTestShippingAddress()); | |
| 1320 controller()->OnDidGetWalletItems(wallet_items.Pass()); | |
| 1321 | |
| 1322 EXPECT_TRUE(controller()->MenuModelForSection(SECTION_CC_BILLING)); | |
| 1323 // "Same as billing", "123 address", "Add address...", and "Manage addresses". | |
| 1324 EXPECT_EQ( | |
| 1325 4, controller()->MenuModelForSection(SECTION_SHIPPING)->GetItemCount()); | |
| 1326 | |
| 1327 // Make sure the menu model item is not created when unwanted. | |
|
Evan Stade
2013/05/23 16:32:12
s/when unwanted/for new wallet users.
Dan Beam
2013/05/23 19:31:16
Done.
| |
| 1328 base::DictionaryValue dict; | |
| 1329 scoped_ptr<base::ListValue> required_actions(new base::ListValue); | |
| 1330 required_actions->AppendString("setup_wallet"); | |
| 1331 dict.Set("required_action", required_actions.release()); | |
| 1332 controller()->OnDidGetWalletItems( | |
| 1333 wallet::WalletItems::CreateWalletItems(dict).Pass()); | |
| 1334 | |
| 1335 EXPECT_FALSE(controller()->MenuModelForSection(SECTION_CC_BILLING)); | |
| 1336 // "Same as billing" and "Add address...". | |
| 1337 EXPECT_EQ( | |
| 1338 2, controller()->MenuModelForSection(SECTION_SHIPPING)->GetItemCount()); | |
| 1339 } | |
| 1340 | |
| 1315 } // namespace autofill | 1341 } // namespace autofill |
| OLD | NEW |