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 "chrome/browser/infobars/confirm_infobar_delegate.h" | 7 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 bool InfoBarWasShown() { | 46 bool InfoBarWasShown() { |
47 return info_bar_shown_; | 47 return info_bar_shown_; |
48 } | 48 } |
49 | 49 |
50 // content::NotificationObserver: | 50 // content::NotificationObserver: |
51 virtual void Observe(int type, | 51 virtual void Observe(int type, |
52 const content::NotificationSource& source, | 52 const content::NotificationSource& source, |
53 const content::NotificationDetails& details) OVERRIDE { | 53 const content::NotificationDetails& details) OVERRIDE { |
54 // Accept in the infobar. | 54 // Accept in the infobar. |
55 InfoBarDelegate* infobar = infobar_service_->GetInfoBarDelegateAt(0); | 55 InfoBarDelegate* infobar = infobar_service_->infobar_at(0); |
56 ConfirmInfoBarDelegate* confirm_infobar = | 56 ConfirmInfoBarDelegate* confirm_infobar = |
57 infobar->AsConfirmInfoBarDelegate(); | 57 infobar->AsConfirmInfoBarDelegate(); |
58 confirm_infobar->Accept(); | 58 confirm_infobar->Accept(); |
59 info_bar_shown_ = true; | 59 info_bar_shown_ = true; |
60 } | 60 } |
61 | 61 |
62 // content::WebContentsObserver | 62 // content::WebContentsObserver |
63 virtual void DidFinishLoad( | 63 virtual void DidFinishLoad( |
64 int64 frame_id, | 64 int64 frame_id, |
65 const GURL& validated_url, | 65 const GURL& validated_url, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // cases where the element that users click on isn't a submit button. | 121 // cases where the element that users click on isn't a submit button. |
122 NavigationObserver observer(WebContents()); | 122 NavigationObserver observer(WebContents()); |
123 std::string fill_and_navigate = | 123 std::string fill_and_navigate = |
124 "document.getElementById('username_field').value = 'temp';" | 124 "document.getElementById('username_field').value = 'temp';" |
125 "document.getElementById('password_field').value = 'random';" | 125 "document.getElementById('password_field').value = 'random';" |
126 "send_xhr()"; | 126 "send_xhr()"; |
127 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_navigate)); | 127 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_navigate)); |
128 observer.Wait(); | 128 observer.Wait(); |
129 EXPECT_FALSE(observer.InfoBarWasShown()); | 129 EXPECT_FALSE(observer.InfoBarWasShown()); |
130 } | 130 } |
OLD | NEW |