| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
| 9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 12 #include "chrome/browser/infobars/infobar.h" |
| 12 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
| 13 #include "chrome/browser/password_manager/password_store_factory.h" | 14 #include "chrome/browser/password_manager/password_store_factory.h" |
| 14 #include "chrome/browser/password_manager/test_password_store.h" | 15 #include "chrome/browser/password_manager/test_password_store.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 17 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 18 #include "chrome/test/base/test_switches.h" | 19 #include "chrome/test/base/test_switches.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "components/autofill/core/browser/autofill_common_test.h" | 21 #include "components/autofill/core/browser/autofill_common_test.h" |
| 21 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // If a path is set, Wait() will return after this path has been seen, | 58 // If a path is set, Wait() will return after this path has been seen, |
| 58 // regardless of the frame that navigated. Useful for multi-frame pages. | 59 // regardless of the frame that navigated. Useful for multi-frame pages. |
| 59 void SetPathToWaitFor(const std::string& path) { | 60 void SetPathToWaitFor(const std::string& path) { |
| 60 wait_for_path_ = path; | 61 wait_for_path_ = path; |
| 61 } | 62 } |
| 62 | 63 |
| 63 // content::NotificationObserver: | 64 // content::NotificationObserver: |
| 64 virtual void Observe(int type, | 65 virtual void Observe(int type, |
| 65 const content::NotificationSource& source, | 66 const content::NotificationSource& source, |
| 66 const content::NotificationDetails& details) OVERRIDE { | 67 const content::NotificationDetails& details) OVERRIDE { |
| 67 infobar_service_->infobar_at(0)->AsConfirmInfoBarDelegate()->Accept(); | 68 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate()-> |
| 69 Accept(); |
| 68 infobar_shown_ = true; | 70 infobar_shown_ = true; |
| 69 } | 71 } |
| 70 | 72 |
| 71 // content::WebContentsObserver: | 73 // content::WebContentsObserver: |
| 72 virtual void DidFinishLoad( | 74 virtual void DidFinishLoad( |
| 73 int64 frame_id, | 75 int64 frame_id, |
| 74 const GURL& validated_url, | 76 const GURL& validated_url, |
| 75 bool is_main_frame, | 77 bool is_main_frame, |
| 76 content::RenderViewHost* render_view_host) OVERRIDE { | 78 content::RenderViewHost* render_view_host) OVERRIDE { |
| 77 if (!wait_for_path_.empty()) { | 79 if (!wait_for_path_.empty()) { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 // was likely an account creation form since it has more than 2 text input | 351 // was likely an account creation form since it has more than 2 text input |
| 350 // fields and was used for the first time on a different form. | 352 // fields and was used for the first time on a different form. |
| 351 base::HistogramBase* upload_histogram = | 353 base::HistogramBase* upload_histogram = |
| 352 base::StatisticsRecorder::FindHistogram( | 354 base::StatisticsRecorder::FindHistogram( |
| 353 "PasswordGeneration.UploadStarted"); | 355 "PasswordGeneration.UploadStarted"); |
| 354 scoped_ptr<base::HistogramSamples> snapshot = | 356 scoped_ptr<base::HistogramSamples> snapshot = |
| 355 upload_histogram->SnapshotSamples(); | 357 upload_histogram->SnapshotSamples(); |
| 356 EXPECT_EQ(0, snapshot->GetCount(0 /* failure */)); | 358 EXPECT_EQ(0, snapshot->GetCount(0 /* failure */)); |
| 357 EXPECT_EQ(1, snapshot->GetCount(1 /* success */)); | 359 EXPECT_EQ(1, snapshot->GetCount(1 /* success */)); |
| 358 } | 360 } |
| OLD | NEW |