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

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc

Issue 256333003: Revert of Password bubble: Introduce a command to open the bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
deleted file mode 100644
index 788752bee74bd33135761b3af5ca6affdaea0a83..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
-
-#include "base/metrics/histogram_samples.h"
-#include "base/test/statistics_delta_reader.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/views/passwords/manage_passwords_view_test.h"
-#include "components/password_manager/core/browser/password_manager_metrics_util.h"
-#include "components/password_manager/core/browser/stub_password_manager_client.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-const char kDisplayDispositionMetric[] = "PasswordBubble.DisplayDisposition";
-
-} // namespace
-
-typedef ManagePasswordsViewTest ManagePasswordsBubbleViewTest;
-
-IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, BasicOpenAndClose) {
- EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing());
- ManagePasswordsBubbleView::ShowBubble(
- browser()->tab_strip_model()->GetActiveWebContents(),
- ManagePasswordsBubble::USER_ACTION);
- EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
- ManagePasswordsBubbleView::CloseBubble();
- EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing());
-
- // And, just for grins, ensure that we can re-open the bubble.
- ManagePasswordsBubbleView::ShowBubble(
- browser()->tab_strip_model()->GetActiveWebContents(),
- ManagePasswordsBubble::USER_ACTION);
- EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
- ManagePasswordsBubbleView::CloseBubble();
- EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing());
-}
-
-// Same as 'BasicOpenAndClose', but use the command rather than the static
-// method directly.
-IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, CommandControlsBubble) {
- // The command only works if the icon is visible, so get into management mode.
- SetupManagingPasswords();
- EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing());
- ExecuteManagePasswordsCommand();
- EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
- ManagePasswordsBubbleView::CloseBubble();
- EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing());
-
- // And, just for grins, ensure that we can re-open the bubble.
- ExecuteManagePasswordsCommand();
- EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
- ManagePasswordsBubbleView::CloseBubble();
- EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing());
-}
-
-IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest,
- CommandExecutionInManagingState) {
- base::StatisticsDeltaReader statistics_delta_reader;
-
- SetupManagingPasswords();
- ExecuteManagePasswordsCommand();
-
- scoped_ptr<base::HistogramSamples> samples(
- statistics_delta_reader.GetHistogramSamplesSinceCreation(
- kDisplayDispositionMetric));
- EXPECT_EQ(
- 0,
- samples->GetCount(
- password_manager::metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING));
- EXPECT_EQ(0,
- samples->GetCount(
- password_manager::metrics_util::MANUAL_WITH_PASSWORD_PENDING));
- EXPECT_EQ(1,
- samples->GetCount(
- password_manager::metrics_util::MANUAL_MANAGE_PASSWORDS));
-}
-
-IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest,
- CommandExecutionInAutomaticState) {
- base::StatisticsDeltaReader statistics_delta_reader;
-
- SetupPendingPassword();
- ExecuteManagePasswordsCommand();
-
- scoped_ptr<base::HistogramSamples> samples(
- statistics_delta_reader.GetHistogramSamplesSinceCreation(
- kDisplayDispositionMetric));
- EXPECT_EQ(
- 1,
- samples->GetCount(
- password_manager::metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING));
- EXPECT_EQ(0,
- samples->GetCount(
- password_manager::metrics_util::MANUAL_WITH_PASSWORD_PENDING));
- EXPECT_EQ(0,
- samples->GetCount(
- password_manager::metrics_util::MANUAL_MANAGE_PASSWORDS));
-}
-
-IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest,
- CommandExecutionInPendingState) {
- base::StatisticsDeltaReader statistics_delta_reader;
-
- SetupPendingPassword();
- // Open once with pending password: automagical!
- ExecuteManagePasswordsCommand();
- ManagePasswordsBubbleView::CloseBubble();
- // This opening should be measured as manual.
- ExecuteManagePasswordsCommand();
-
- scoped_ptr<base::HistogramSamples> samples(
- statistics_delta_reader.GetHistogramSamplesSinceCreation(
- kDisplayDispositionMetric));
- EXPECT_EQ(
- 1,
- samples->GetCount(
- password_manager::metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING));
- EXPECT_EQ(1,
- samples->GetCount(
- password_manager::metrics_util::MANUAL_WITH_PASSWORD_PENDING));
- EXPECT_EQ(0,
- samples->GetCount(
- password_manager::metrics_util::MANUAL_MANAGE_PASSWORDS));
-}

Powered by Google App Engine
This is Rietveld 408576698