| 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 tab_contents_wrapper->controller()); |
| 323 infobar_->AsConfirmInfoBarDelegate()->Cancel(); | 323 if (allowed) |
| 324 WaitForNavigation(); | 324 infobar_->AsConfirmInfoBarDelegate()->Accept(); |
| 325 else |
| 326 infobar_->AsConfirmInfoBarDelegate()->Cancel(); |
| 327 observer.Wait(); |
| 328 } |
| 329 |
| 325 tab_contents_wrapper->RemoveInfoBar(infobar_); | 330 tab_contents_wrapper->RemoveInfoBar(infobar_); |
| 326 LOG(WARNING) << "infobar response set"; | 331 LOG(WARNING) << "infobar response set"; |
| 327 infobar_ = NULL; | 332 infobar_ = NULL; |
| 328 EXPECT_GT(settings_state.state_map().size(), state_map_size); | 333 EXPECT_GT(settings_state.state_map().size(), state_map_size); |
| 329 GURL requesting_origin = requesting_url.GetOrigin(); | 334 GURL requesting_origin = requesting_url.GetOrigin(); |
| 330 EXPECT_EQ(1U, settings_state.state_map().count(requesting_origin)); | 335 EXPECT_EQ(1U, settings_state.state_map().count(requesting_origin)); |
| 331 ContentSetting expected_setting = | 336 ContentSetting expected_setting = |
| 332 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 337 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 333 EXPECT_EQ(expected_setting, | 338 EXPECT_EQ(expected_setting, |
| 334 settings_state.state_map().find(requesting_origin)->second); | 339 settings_state.state_map().find(requesting_origin)->second); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 "window.domAutomationController.setAutomationId(0);" | 650 "window.domAutomationController.setAutomationId(0);" |
| 646 "window.domAutomationController.send(window.close());"; | 651 "window.domAutomationController.send(window.close());"; |
| 647 bool result = | 652 bool result = |
| 648 ui_test_utils::ExecuteJavaScript( | 653 ui_test_utils::ExecuteJavaScript( |
| 649 current_browser_->GetSelectedTabContents()->render_view_host(), | 654 current_browser_->GetSelectedTabContents()->render_view_host(), |
| 650 L"", UTF8ToWide(script)); | 655 L"", UTF8ToWide(script)); |
| 651 EXPECT_EQ(result, true); | 656 EXPECT_EQ(result, true); |
| 652 } | 657 } |
| 653 | 658 |
| 654 } // namespace | 659 } // namespace |
| OLD | NEW |