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

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

Issue 603383003: Declaring the weak_ptr_factory in proper order. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 : AutofillDialogControllerImpl(contents, 124 : AutofillDialogControllerImpl(contents,
125 form_data, 125 form_data,
126 form_data.origin, 126 form_data.origin,
127 base::Bind(&MockCallback)), 127 base::Bind(&MockCallback)),
128 metric_logger_(metric_logger), 128 metric_logger_(metric_logger),
129 mock_wallet_client_( 129 mock_wallet_client_(
130 Profile::FromBrowserContext(contents->GetBrowserContext())-> 130 Profile::FromBrowserContext(contents->GetBrowserContext())->
131 GetRequestContext(), this, form_data.origin), 131 GetRequestContext(), this, form_data.origin),
132 message_loop_runner_(runner), 132 message_loop_runner_(runner),
133 use_validation_(false), 133 use_validation_(false),
134 weak_ptr_factory_(this), 134 sign_in_user_index_(0U),
135 sign_in_user_index_(0U) { 135 weak_ptr_factory_(this) {
136 test_manager_.Init( 136 test_manager_.Init(
137 NULL, 137 NULL,
138 Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs(), 138 Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs(),
139 false); 139 false);
140 } 140 }
141 141
142 virtual ~TestAutofillDialogController() {} 142 virtual ~TestAutofillDialogController() {}
143 143
144 virtual GURL SignInUrl() const OVERRIDE { 144 virtual GURL SignInUrl() const OVERRIDE {
145 return GURL(chrome::kChromeUIVersionURL); 145 return GURL(chrome::kChromeUIVersionURL);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 TestPersonalDataManager test_manager_; 254 TestPersonalDataManager test_manager_;
255 testing::NiceMock<MockAddressValidator> mock_validator_; 255 testing::NiceMock<MockAddressValidator> mock_validator_;
256 testing::NiceMock<wallet::MockWalletClient> mock_wallet_client_; 256 testing::NiceMock<wallet::MockWalletClient> mock_wallet_client_;
257 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 257 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
258 bool use_validation_; 258 bool use_validation_;
259 259
260 // A list of notifications to show in the notification area of the dialog. 260 // A list of notifications to show in the notification area of the dialog.
261 // This is used to control what |CurrentNotifications()| returns for testing. 261 // This is used to control what |CurrentNotifications()| returns for testing.
262 std::vector<DialogNotification> notifications_; 262 std::vector<DialogNotification> notifications_;
263 263
264 // The user index that is assigned in IsSignInContinueUrl().
265 size_t sign_in_user_index_;
266
264 // Allows generation of WeakPtrs, so controller liveness can be tested. 267 // Allows generation of WeakPtrs, so controller liveness can be tested.
265 base::WeakPtrFactory<TestAutofillDialogController> weak_ptr_factory_; 268 base::WeakPtrFactory<TestAutofillDialogController> weak_ptr_factory_;
266 269
267 // The user index that is assigned in IsSignInContinueUrl().
268 size_t sign_in_user_index_;
269
270 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController); 270 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController);
271 }; 271 };
272 272
273 // This is a copy of ui_test_utils::UrlLoadObserver, except it observes 273 // This is a copy of ui_test_utils::UrlLoadObserver, except it observes
274 // NAV_ENTRY_COMMITTED instead of LOAD_STOP. This is to match the notification 274 // NAV_ENTRY_COMMITTED instead of LOAD_STOP. This is to match the notification
275 // that AutofillDialogControllerImpl observes. Since NAV_ENTRY_COMMITTED comes 275 // that AutofillDialogControllerImpl observes. Since NAV_ENTRY_COMMITTED comes
276 // before LOAD_STOP, and the controller deletes the web contents after receiving 276 // before LOAD_STOP, and the controller deletes the web contents after receiving
277 // the former, we will sometimes fail to observe a LOAD_STOP. 277 // the former, we will sometimes fail to observe a LOAD_STOP.
278 // TODO(estade): Should the controller observe LOAD_STOP instead? 278 // TODO(estade): Should the controller observe LOAD_STOP instead?
279 class NavEntryCommittedObserver : public content::WindowedNotificationObserver { 279 class NavEntryCommittedObserver : public content::WindowedNotificationObserver {
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 "<input autocomplete='transaction-currency' value='USD'>" 1766 "<input autocomplete='transaction-currency' value='USD'>"
1767 "<input autocomplete='cc-csc'>"); 1767 "<input autocomplete='cc-csc'>");
1768 AutofillDialogControllerImpl* controller = SetUpHtmlAndInvoke(html); 1768 AutofillDialogControllerImpl* controller = SetUpHtmlAndInvoke(html);
1769 ASSERT_TRUE(controller); 1769 ASSERT_TRUE(controller);
1770 1770
1771 EXPECT_EQ(ASCIIToUTF16("24"), controller->transaction_amount_); 1771 EXPECT_EQ(ASCIIToUTF16("24"), controller->transaction_amount_);
1772 EXPECT_EQ(ASCIIToUTF16("USD"), controller->transaction_currency_); 1772 EXPECT_EQ(ASCIIToUTF16("USD"), controller->transaction_currency_);
1773 } 1773 }
1774 1774
1775 } // namespace autofill 1775 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698