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

Side by Side Diff: chrome/browser/ui/views/passwords/password_dialog_view_browsertest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 6 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 11 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/browser/ui/views/passwords/account_chooser_dialog_view.h" 12 #include "chrome/browser/ui/views/passwords/account_chooser_dialog_view.h"
13 #include "chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.h" 13 #include "chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "components/password_manager/core/browser/password_bubble_experiment.h" 16 #include "components/password_manager/core/browser/password_bubble_experiment.h"
17 #include "components/password_manager/core/common/password_manager_pref_names.h" 17 #include "components/password_manager/core/common/password_manager_pref_names.h"
18 #include "components/prefs/pref_service.h" 18 #include "components/prefs/pref_service.h"
19 #include "net/url_request/test_url_fetcher_factory.h" 19 #include "net/url_request/test_url_fetcher_factory.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 using ::testing::Field; 23 using ::testing::Field;
24 24
25 namespace { 25 namespace {
26 26
27 // A helper class that will create FakeURLFetcher and record the requested URLs. 27 // A helper class that will create FakeURLFetcher and record the requested URLs.
28 class TestURLFetcherCallback { 28 class TestURLFetcherCallback {
29 public: 29 public:
30 scoped_ptr<net::FakeURLFetcher> CreateURLFetcher( 30 std::unique_ptr<net::FakeURLFetcher> CreateURLFetcher(
31 const GURL& url, 31 const GURL& url,
32 net::URLFetcherDelegate* d, 32 net::URLFetcherDelegate* d,
33 const std::string& response_data, 33 const std::string& response_data,
34 net::HttpStatusCode response_code, 34 net::HttpStatusCode response_code,
35 net::URLRequestStatus::Status status) { 35 net::URLRequestStatus::Status status) {
36 OnRequestDone(url); 36 OnRequestDone(url);
37 return scoped_ptr<net::FakeURLFetcher>(new net::FakeURLFetcher( 37 return std::unique_ptr<net::FakeURLFetcher>(
38 url, d, response_data, response_code, status)); 38 new net::FakeURLFetcher(url, d, response_data, response_code, status));
39 } 39 }
40 40
41 MOCK_METHOD1(OnRequestDone, void(const GURL&)); 41 MOCK_METHOD1(OnRequestDone, void(const GURL&));
42 }; 42 };
43 43
44 // ManagePasswordsUIController subclass to capture the dialog instance 44 // ManagePasswordsUIController subclass to capture the dialog instance
45 class TestManagePasswordsUIController : public ManagePasswordsUIController { 45 class TestManagePasswordsUIController : public ManagePasswordsUIController {
46 public: 46 public:
47 explicit TestManagePasswordsUIController(content::WebContents* web_contents); 47 explicit TestManagePasswordsUIController(content::WebContents* web_contents);
48 48
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 autofill::PasswordForm form; 378 autofill::PasswordForm form;
379 form.origin = origin; 379 form.origin = origin;
380 form.username_value = base::ASCIIToUTF16("peter@pan.test"); 380 form.username_value = base::ASCIIToUTF16("peter@pan.test");
381 form.password_value = base::ASCIIToUTF16("I can fly!"); 381 form.password_value = base::ASCIIToUTF16("I can fly!");
382 382
383 // Successful login alone will not prompt: 383 // Successful login alone will not prompt:
384 client()->NotifySuccessfulLoginWithExistingPassword(form); 384 client()->NotifySuccessfulLoginWithExistingPassword(form);
385 ASSERT_FALSE(controller()->current_autosignin_prompt()); 385 ASSERT_FALSE(controller()->current_autosignin_prompt());
386 386
387 // Blocked automatic sign-in will not prompt: 387 // Blocked automatic sign-in will not prompt:
388 scoped_ptr<autofill::PasswordForm> blocked_form( 388 std::unique_ptr<autofill::PasswordForm> blocked_form(
389 new autofill::PasswordForm(form)); 389 new autofill::PasswordForm(form));
390 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); 390 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form));
391 ASSERT_FALSE(controller()->current_autosignin_prompt()); 391 ASSERT_FALSE(controller()->current_autosignin_prompt());
392 392
393 // Successful login with a distinct form after block will not prompt: 393 // Successful login with a distinct form after block will not prompt:
394 blocked_form.reset(new autofill::PasswordForm(form)); 394 blocked_form.reset(new autofill::PasswordForm(form));
395 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); 395 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form));
396 form.username_value = base::ASCIIToUTF16("notpeter@pan.test"); 396 form.username_value = base::ASCIIToUTF16("notpeter@pan.test");
397 client()->NotifySuccessfulLoginWithExistingPassword(form); 397 client()->NotifySuccessfulLoginWithExistingPassword(form);
398 ASSERT_FALSE(controller()->current_autosignin_prompt()); 398 ASSERT_FALSE(controller()->current_autosignin_prompt());
(...skipping 10 matching lines...) Expand all
409 password_manager::prefs::kCredentialsEnableAutosignin, true); 409 password_manager::prefs::kCredentialsEnableAutosignin, true);
410 410
411 // Successful login with the same form after block will prompt: 411 // Successful login with the same form after block will prompt:
412 blocked_form.reset(new autofill::PasswordForm(form)); 412 blocked_form.reset(new autofill::PasswordForm(form));
413 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); 413 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form));
414 client()->NotifySuccessfulLoginWithExistingPassword(form); 414 client()->NotifySuccessfulLoginWithExistingPassword(form);
415 ASSERT_TRUE(controller()->current_autosignin_prompt()); 415 ASSERT_TRUE(controller()->current_autosignin_prompt());
416 } 416 }
417 417
418 } // namespace 418 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698