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" | |
13 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
14 #include "chrome/browser/password_manager/password_store_factory.h" | 13 #include "chrome/browser/password_manager/password_store_factory.h" |
15 #include "chrome/browser/password_manager/test_password_store.h" | 14 #include "chrome/browser/password_manager/test_password_store.h" |
16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/test_switches.h" | 18 #include "chrome/test/base/test_switches.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
21 #include "components/autofill/core/browser/autofill_test_utils.h" | 20 #include "components/autofill/core/browser/autofill_test_utils.h" |
22 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // If a path is set, Wait() will return after this path has been seen, | 57 // If a path is set, Wait() will return after this path has been seen, |
59 // regardless of the frame that navigated. Useful for multi-frame pages. | 58 // regardless of the frame that navigated. Useful for multi-frame pages. |
60 void SetPathToWaitFor(const std::string& path) { | 59 void SetPathToWaitFor(const std::string& path) { |
61 wait_for_path_ = path; | 60 wait_for_path_ = path; |
62 } | 61 } |
63 | 62 |
64 // content::NotificationObserver: | 63 // content::NotificationObserver: |
65 virtual void Observe(int type, | 64 virtual void Observe(int type, |
66 const content::NotificationSource& source, | 65 const content::NotificationSource& source, |
67 const content::NotificationDetails& details) OVERRIDE { | 66 const content::NotificationDetails& details) OVERRIDE { |
68 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate()-> | 67 infobar_service_->infobar_at(0)->AsConfirmInfoBarDelegate()->Accept(); |
69 Accept(); | |
70 infobar_shown_ = true; | 68 infobar_shown_ = true; |
71 } | 69 } |
72 | 70 |
73 // content::WebContentsObserver: | 71 // content::WebContentsObserver: |
74 virtual void DidFinishLoad( | 72 virtual void DidFinishLoad( |
75 int64 frame_id, | 73 int64 frame_id, |
76 const GURL& validated_url, | 74 const GURL& validated_url, |
77 bool is_main_frame, | 75 bool is_main_frame, |
78 content::RenderViewHost* render_view_host) OVERRIDE { | 76 content::RenderViewHost* render_view_host) OVERRIDE { |
79 if (!wait_for_path_.empty()) { | 77 if (!wait_for_path_.empty()) { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 "document.getElementById('username_field').value = 'temp';" | 461 "document.getElementById('username_field').value = 'temp';" |
464 "document.getElementById('password_field').value = 'random';" | 462 "document.getElementById('password_field').value = 'random';" |
465 "document.getElementById('input_submit_button').click();" | 463 "document.getElementById('input_submit_button').click();" |
466 "window.location.href = 'done.html';"; | 464 "window.location.href = 'done.html';"; |
467 | 465 |
468 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), save_and_remove)); | 466 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), save_and_remove)); |
469 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame)); | 467 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame)); |
470 observer.Wait(); | 468 observer.Wait(); |
471 // The only thing we check here is that there is no use-after-free reported. | 469 // The only thing we check here is that there is no use-after-free reported. |
472 } | 470 } |
OLD | NEW |