OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 browser->tab_strip_model()->GetActiveWebContents(), | 73 browser->tab_strip_model()->GetActiveWebContents(), |
74 script, | 74 script, |
75 &iframe_src)); | 75 &iframe_src)); |
76 iframe_url_ = GURL(iframe_src); | 76 iframe_url_ = GURL(iframe_src); |
77 } | 77 } |
78 | 78 |
79 GURL iframe_url() const { return iframe_url_; } | 79 GURL iframe_url() const { return iframe_url_; } |
80 | 80 |
81 virtual void Observe(int type, | 81 virtual void Observe(int type, |
82 const content::NotificationSource& source, | 82 const content::NotificationSource& source, |
83 const content::NotificationDetails& details) { | 83 const content::NotificationDetails& details) OVERRIDE { |
84 if (type == content::NOTIFICATION_LOAD_STOP) { | 84 if (type == content::NOTIFICATION_LOAD_STOP) { |
85 navigation_completed_ = true; | 85 navigation_completed_ = true; |
86 } else if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) { | 86 } else if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) { |
87 content::Details<DomOperationNotificationDetails> dom_op_details(details); | 87 content::Details<DomOperationNotificationDetails> dom_op_details(details); |
88 javascript_response_ = dom_op_details->json; | 88 javascript_response_ = dom_op_details->json; |
89 javascript_completed_ = true; | 89 javascript_completed_ = true; |
90 } | 90 } |
91 if (javascript_completed_ && navigation_completed_) | 91 if (javascript_completed_ && navigation_completed_) |
92 MessageLoopForUI::current()->Quit(); | 92 MessageLoopForUI::current()->Quit(); |
93 } | 93 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 if (wait_for_infobar_) { | 149 if (wait_for_infobar_) { |
150 EXPECT_TRUE(infobar_); | 150 EXPECT_TRUE(infobar_); |
151 } else { | 151 } else { |
152 EXPECT_TRUE(navigation_completed_); | 152 EXPECT_TRUE(navigation_completed_); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 // content::NotificationObserver | 156 // content::NotificationObserver |
157 virtual void Observe(int type, | 157 virtual void Observe(int type, |
158 const content::NotificationSource& source, | 158 const content::NotificationSource& source, |
159 const content::NotificationDetails& details) { | 159 const content::NotificationDetails& details) OVERRIDE { |
160 if (type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED) { | 160 if (type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED) { |
161 infobar_ = content::Details<InfoBarAddedDetails>(details).ptr(); | 161 infobar_ = content::Details<InfoBarAddedDetails>(details).ptr(); |
162 ASSERT_TRUE(infobar_->GetIcon()); | 162 ASSERT_TRUE(infobar_->GetIcon()); |
163 ASSERT_TRUE(infobar_->AsConfirmInfoBarDelegate()); | 163 ASSERT_TRUE(infobar_->AsConfirmInfoBarDelegate()); |
164 } else if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) { | 164 } else if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) { |
165 content::Details<DomOperationNotificationDetails> dom_op_details(details); | 165 content::Details<DomOperationNotificationDetails> dom_op_details(details); |
166 javascript_response_ = dom_op_details->json; | 166 javascript_response_ = dom_op_details->json; |
167 LOG(WARNING) << "javascript_response " << javascript_response_; | 167 LOG(WARNING) << "javascript_response " << javascript_response_; |
168 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED || | 168 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED || |
169 type == content::NOTIFICATION_LOAD_START) { | 169 type == content::NOTIFICATION_LOAD_START) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 public: | 204 public: |
205 GeolocationBrowserTest() | 205 GeolocationBrowserTest() |
206 : infobar_(NULL), | 206 : infobar_(NULL), |
207 current_browser_(NULL), | 207 current_browser_(NULL), |
208 html_for_tests_("files/geolocation/simple.html"), | 208 html_for_tests_("files/geolocation/simple.html"), |
209 fake_latitude_(1.23), | 209 fake_latitude_(1.23), |
210 fake_longitude_(4.56), | 210 fake_longitude_(4.56), |
211 started_test_server_(false) {} | 211 started_test_server_(false) {} |
212 | 212 |
213 // InProcessBrowserTest | 213 // InProcessBrowserTest |
214 virtual void SetUpOnMainThread() { | 214 virtual void SetUpOnMainThread() OVERRIDE { |
215 ui_test_utils::OverrideGeolocation(fake_latitude_, fake_longitude_); | 215 ui_test_utils::OverrideGeolocation(fake_latitude_, fake_longitude_); |
216 } | 216 } |
217 | 217 |
218 // InProcessBrowserTest | 218 // InProcessBrowserTest |
219 virtual void TearDownInProcessBrowserTestFixture() { | 219 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
220 LOG(WARNING) << "TearDownInProcessBrowserTestFixture. Test Finished."; | 220 LOG(WARNING) << "TearDownInProcessBrowserTestFixture. Test Finished."; |
221 } | 221 } |
222 | 222 |
223 enum InitializationOptions { | 223 enum InitializationOptions { |
224 INITIALIZATION_NONE, | 224 INITIALIZATION_NONE, |
225 INITIALIZATION_OFFTHERECORD, | 225 INITIALIZATION_OFFTHERECORD, |
226 INITIALIZATION_NEWTAB, | 226 INITIALIZATION_NEWTAB, |
227 INITIALIZATION_IFRAMES, | 227 INITIALIZATION_IFRAMES, |
228 }; | 228 }; |
229 | 229 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 std::string script = | 656 std::string script = |
657 "window.domAutomationController.send(window.close());"; | 657 "window.domAutomationController.send(window.close());"; |
658 bool result = | 658 bool result = |
659 content::ExecuteScript( | 659 content::ExecuteScript( |
660 current_browser_->tab_strip_model()->GetActiveWebContents(), | 660 current_browser_->tab_strip_model()->GetActiveWebContents(), |
661 script); | 661 script); |
662 EXPECT_EQ(result, true); | 662 EXPECT_EQ(result, true); |
663 } | 663 } |
664 | 664 |
665 } // namespace | 665 } // namespace |
OLD | NEW |