| OLD | NEW |
| 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/views/passwords/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/metrics/histogram_samples.h" | 12 #include "base/metrics/histogram_samples.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/test/scoped_feature_list.h" | |
| 15 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/passwords/manage_passwords_test.h" | 16 #include "chrome/browser/ui/passwords/manage_passwords_test.h" |
| 18 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" | 17 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" |
| 19 #include "chrome/browser/ui/tab_dialogs.h" | 18 #include "chrome/browser/ui/tab_dialogs.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/browser/ui/views/frame/browser_view.h" | 20 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 22 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" | 21 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
| 23 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 22 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 24 #include "chrome/test/base/interactive_test_utils.h" | 23 #include "chrome/test/base/interactive_test_utils.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 EXPECT_FALSE(IsBubbleShowing()); | 293 EXPECT_FALSE(IsBubbleShowing()); |
| 295 EXPECT_EQ(1, tab_model->active_index()); | 294 EXPECT_EQ(1, tab_model->active_index()); |
| 296 SetupPendingPassword(); | 295 SetupPendingPassword(); |
| 297 EXPECT_TRUE(IsBubbleShowing()); | 296 EXPECT_TRUE(IsBubbleShowing()); |
| 298 // Back to the first tab. | 297 // Back to the first tab. |
| 299 tab_model->ActivateTabAt(0, true); | 298 tab_model->ActivateTabAt(0, true); |
| 300 EXPECT_FALSE(IsBubbleShowing()); | 299 EXPECT_FALSE(IsBubbleShowing()); |
| 301 } | 300 } |
| 302 | 301 |
| 303 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, AutoSignin) { | 302 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, AutoSignin) { |
| 304 base::test::ScopedFeatureList scoped_feature_list; | |
| 305 scoped_feature_list.InitAndEnableFeature(features::kCredentialManagementAPI); | |
| 306 ASSERT_TRUE(base::FeatureList::IsEnabled(features::kCredentialManagementAPI)); | |
| 307 | |
| 308 test_form()->origin = GURL("https://example.com"); | 303 test_form()->origin = GURL("https://example.com"); |
| 309 test_form()->display_name = base::ASCIIToUTF16("Peter"); | 304 test_form()->display_name = base::ASCIIToUTF16("Peter"); |
| 310 test_form()->username_value = base::ASCIIToUTF16("pet12@gmail.com"); | 305 test_form()->username_value = base::ASCIIToUTF16("pet12@gmail.com"); |
| 311 GURL icon_url("https://google.com/icon.png"); | 306 GURL icon_url("https://google.com/icon.png"); |
| 312 test_form()->icon_url = icon_url; | 307 test_form()->icon_url = icon_url; |
| 313 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials; | 308 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials; |
| 314 local_credentials.push_back( | 309 local_credentials.push_back( |
| 315 base::MakeUnique<autofill::PasswordForm>(*test_form())); | 310 base::MakeUnique<autofill::PasswordForm>(*test_form())); |
| 316 | 311 |
| 317 // Prepare to capture the network request. | 312 // Prepare to capture the network request. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 357 |
| 363 // Sign-in dialogs opened for inactive browser windows do not auto-close on | 358 // Sign-in dialogs opened for inactive browser windows do not auto-close on |
| 364 // MacOS. This matches existing Cocoa bubble behavior. | 359 // MacOS. This matches existing Cocoa bubble behavior. |
| 365 // TODO(varkha): Remove the limitation as part of http://crbug/671916 . | 360 // TODO(varkha): Remove the limitation as part of http://crbug/671916 . |
| 366 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) | 361 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) |
| 367 EXPECT_FALSE(IsBubbleShowing()); | 362 EXPECT_FALSE(IsBubbleShowing()); |
| 368 #else | 363 #else |
| 369 EXPECT_TRUE(IsBubbleShowing()); | 364 EXPECT_TRUE(IsBubbleShowing()); |
| 370 #endif | 365 #endif |
| 371 } | 366 } |
| OLD | NEW |