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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // Crashy, http://crbug.com/70585. | 382 // Crashy, http://crbug.com/70585. |
383 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, | 383 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, |
384 DISABLED_ErrorOnPermissionDenied) { | 384 DISABLED_ErrorOnPermissionDenied) { |
385 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); | 385 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); |
386 AddGeolocationWatch(true); | 386 AddGeolocationWatch(true); |
387 // Infobar was displayed, deny access and check for error code. | 387 // Infobar was displayed, deny access and check for error code. |
388 SetInfobarResponse(current_url_, false); | 388 SetInfobarResponse(current_url_, false); |
389 CheckStringValueFromJavascript("1", "geoGetLastError()"); | 389 CheckStringValueFromJavascript("1", "geoGetLastError()"); |
390 } | 390 } |
391 | 391 |
392 // http://crbug.com/44589. Hangs on Mac, crashes on Windows | 392 // http://crbug.com/44589 and http://crbug.com/129065. |
393 #if defined(OS_MACOSX) || defined(OS_WIN) | 393 // Hangs on mac, crashes on linux and windows. |
394 #define MAYBE_NoInfobarForSecondTab DISABLED_NoInfobarForSecondTab | 394 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_NoInfobarForSecondTab) { |
395 #else | |
396 #define MAYBE_NoInfobarForSecondTab NoInfobarForSecondTab | |
397 #endif | |
398 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForSecondTab) { | |
399 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); | 395 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); |
400 AddGeolocationWatch(true); | 396 AddGeolocationWatch(true); |
401 SetInfobarResponse(current_url_, true); | 397 SetInfobarResponse(current_url_, true); |
402 // Disables further prompts from this tab. | 398 // Disables further prompts from this tab. |
403 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)"); | 399 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)"); |
404 | 400 |
405 // Checks infobar will not be created a second tab. | 401 // Checks infobar will not be created a second tab. |
406 ASSERT_TRUE(Initialize(INITIALIZATION_NEWTAB)); | 402 ASSERT_TRUE(Initialize(INITIALIZATION_NEWTAB)); |
407 AddGeolocationWatch(false); | 403 AddGeolocationWatch(false); |
408 CheckGeoposition(fake_latitude_, fake_longitude_); | 404 CheckGeoposition(fake_latitude_, fake_longitude_); |
(...skipping 15 matching lines...) Expand all Loading... |
424 CONTENT_SETTING_BLOCK); | 420 CONTENT_SETTING_BLOCK); |
425 AddGeolocationWatch(false); | 421 AddGeolocationWatch(false); |
426 // Checks we have an error for this denied origin. | 422 // Checks we have an error for this denied origin. |
427 CheckStringValueFromJavascript("1", "geoGetLastError()"); | 423 CheckStringValueFromJavascript("1", "geoGetLastError()"); |
428 // Checks infobar will not be created a second tab. | 424 // Checks infobar will not be created a second tab. |
429 ASSERT_TRUE(Initialize(INITIALIZATION_NEWTAB)); | 425 ASSERT_TRUE(Initialize(INITIALIZATION_NEWTAB)); |
430 AddGeolocationWatch(false); | 426 AddGeolocationWatch(false); |
431 CheckStringValueFromJavascript("1", "geoGetLastError()"); | 427 CheckStringValueFromJavascript("1", "geoGetLastError()"); |
432 } | 428 } |
433 | 429 |
434 // http://crbug.com/100763. Crashes occasionally on XP. | 430 // http://crbug.com/100763 and http://crbug.com/129065. |
435 #if defined(OS_WIN) | 431 // Crashes occasionally on XP and linux. |
| 432 #if defined(OS_WIN) || defined(OS_LINUX) |
436 #define MAYBE_NoInfobarForAllowedOrigin DISABLED_NoInfobarForAllowedOrigin | 433 #define MAYBE_NoInfobarForAllowedOrigin DISABLED_NoInfobarForAllowedOrigin |
437 #else | 434 #else |
438 #define MAYBE_NoInfobarForAllowedOrigin NoInfobarForAllowedOrigin | 435 #define MAYBE_NoInfobarForAllowedOrigin NoInfobarForAllowedOrigin |
439 #endif | 436 #endif |
440 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForAllowedOrigin)
{ | 437 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForAllowedOrigin)
{ |
441 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); | 438 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); |
442 current_browser_->profile()->GetHostContentSettingsMap()-> | 439 current_browser_->profile()->GetHostContentSettingsMap()-> |
443 SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(current_url_), | 440 SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(current_url_), |
444 ContentSettingsPattern::FromURLNoWildcard(current_url_), | 441 ContentSettingsPattern::FromURLNoWildcard(current_url_), |
445 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 442 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
446 std::string(), | 443 std::string(), |
447 CONTENT_SETTING_ALLOW); | 444 CONTENT_SETTING_ALLOW); |
448 // Checks no infobar will be created and there's no error callback. | 445 // Checks no infobar will be created and there's no error callback. |
449 AddGeolocationWatch(false); | 446 AddGeolocationWatch(false); |
450 CheckGeoposition(fake_latitude_, fake_longitude_); | 447 CheckGeoposition(fake_latitude_, fake_longitude_); |
451 } | 448 } |
452 | 449 |
453 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoInfobarForOffTheRecord) { | 450 // Crashes on linux. |
| 451 // http://crbug.com/129065 |
| 452 #if defined(OS_LINUX) |
| 453 #define MAYBE_NoInfobarForOffTheRecord DISABLED_NoInfobarForOffTheRecord |
| 454 #else |
| 455 #define MAYBE_NoInfobarForOffTheRecord NoInfobarForOffTheRecord |
| 456 #endif |
| 457 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForOffTheRecord) { |
454 // First, check infobar will be created for regular profile | 458 // First, check infobar will be created for regular profile |
455 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); | 459 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); |
456 AddGeolocationWatch(true); | 460 AddGeolocationWatch(true); |
457 // Response will be persisted | 461 // Response will be persisted |
458 SetInfobarResponse(current_url_, true); | 462 SetInfobarResponse(current_url_, true); |
459 CheckGeoposition(fake_latitude_, fake_longitude_); | 463 CheckGeoposition(fake_latitude_, fake_longitude_); |
460 // Disables further prompts from this tab. | 464 // Disables further prompts from this tab. |
461 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)"); | 465 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)"); |
462 // Go incognito, and checks no infobar will be created. | 466 // Go incognito, and checks no infobar will be created. |
463 ASSERT_TRUE(Initialize(INITIALIZATION_OFFTHERECORD)); | 467 ASSERT_TRUE(Initialize(INITIALIZATION_OFFTHERECORD)); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 "window.domAutomationController.setAutomationId(0);" | 666 "window.domAutomationController.setAutomationId(0);" |
663 "window.domAutomationController.send(window.close());"; | 667 "window.domAutomationController.send(window.close());"; |
664 bool result = | 668 bool result = |
665 ui_test_utils::ExecuteJavaScript( | 669 ui_test_utils::ExecuteJavaScript( |
666 current_browser_->GetSelectedWebContents()->GetRenderViewHost(), | 670 current_browser_->GetSelectedWebContents()->GetRenderViewHost(), |
667 L"", UTF8ToWide(script)); | 671 L"", UTF8ToWide(script)); |
668 EXPECT_EQ(result, true); | 672 EXPECT_EQ(result, true); |
669 } | 673 } |
670 | 674 |
671 } // namespace | 675 } // namespace |
OLD | NEW |