| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 10 #include "chrome/browser/dom_operation_notification_details.h" | 10 #include "chrome/browser/dom_operation_notification_details.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 void SetInfobarResponse(const GURL& requesting_url, bool allowed) { | 310 void SetInfobarResponse(const GURL& requesting_url, bool allowed) { |
| 311 TabContentsWrapper* tab_contents_wrapper = | 311 TabContentsWrapper* tab_contents_wrapper = |
| 312 current_browser_->GetSelectedTabContentsWrapper(); | 312 current_browser_->GetSelectedTabContentsWrapper(); |
| 313 TabSpecificContentSettings* content_settings = | 313 TabSpecificContentSettings* content_settings = |
| 314 tab_contents_wrapper->content_settings(); | 314 tab_contents_wrapper->content_settings(); |
| 315 const GeolocationSettingsState& settings_state = | 315 const GeolocationSettingsState& settings_state = |
| 316 content_settings->geolocation_settings_state(); | 316 content_settings->geolocation_settings_state(); |
| 317 size_t state_map_size = settings_state.state_map().size(); | 317 size_t state_map_size = settings_state.state_map().size(); |
| 318 ASSERT_TRUE(infobar_); | 318 ASSERT_TRUE(infobar_); |
| 319 LOG(WARNING) << "will set infobar response"; | 319 LOG(WARNING) << "will set infobar response"; |
| 320 if (allowed) | 320 { |
| 321 infobar_->AsConfirmInfoBarDelegate()->Accept(); | 321 ui_test_utils::WindowedNotificationObserver observer( |
| 322 else | 322 content::NOTIFICATION_LOAD_STOP, |
| 323 infobar_->AsConfirmInfoBarDelegate()->Cancel(); | 323 Source<NavigationController>(&tab_contents_wrapper->controller())); |
| 324 WaitForNavigation(); | 324 if (allowed) |
| 325 infobar_->AsConfirmInfoBarDelegate()->Accept(); |
| 326 else |
| 327 infobar_->AsConfirmInfoBarDelegate()->Cancel(); |
| 328 observer.Wait(); |
| 329 } |
| 330 |
| 325 tab_contents_wrapper->RemoveInfoBar(infobar_); | 331 tab_contents_wrapper->RemoveInfoBar(infobar_); |
| 326 LOG(WARNING) << "infobar response set"; | 332 LOG(WARNING) << "infobar response set"; |
| 327 infobar_ = NULL; | 333 infobar_ = NULL; |
| 328 EXPECT_GT(settings_state.state_map().size(), state_map_size); | 334 EXPECT_GT(settings_state.state_map().size(), state_map_size); |
| 329 GURL requesting_origin = requesting_url.GetOrigin(); | 335 GURL requesting_origin = requesting_url.GetOrigin(); |
| 330 EXPECT_EQ(1U, settings_state.state_map().count(requesting_origin)); | 336 EXPECT_EQ(1U, settings_state.state_map().count(requesting_origin)); |
| 331 ContentSetting expected_setting = | 337 ContentSetting expected_setting = |
| 332 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 338 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 333 EXPECT_EQ(expected_setting, | 339 EXPECT_EQ(expected_setting, |
| 334 settings_state.state_map().find(requesting_origin)->second); | 340 settings_state.state_map().find(requesting_origin)->second); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 "window.domAutomationController.setAutomationId(0);" | 655 "window.domAutomationController.setAutomationId(0);" |
| 650 "window.domAutomationController.send(window.close());"; | 656 "window.domAutomationController.send(window.close());"; |
| 651 bool result = | 657 bool result = |
| 652 ui_test_utils::ExecuteJavaScript( | 658 ui_test_utils::ExecuteJavaScript( |
| 653 current_browser_->GetSelectedTabContents()->render_view_host(), | 659 current_browser_->GetSelectedTabContents()->render_view_host(), |
| 654 L"", UTF8ToWide(script)); | 660 L"", UTF8ToWide(script)); |
| 655 EXPECT_EQ(result, true); | 661 EXPECT_EQ(result, true); |
| 656 } | 662 } |
| 657 | 663 |
| 658 } // namespace | 664 } // namespace |
| OLD | NEW |