Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/geolocation/geolocation_browsertest.cc

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/gpu_pixel_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <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 10 matching lines...) Expand all
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
22 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/content_settings_pattern.h" 24 #include "chrome/common/content_settings_pattern.h"
25 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
26 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
27 #include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h " 27 #include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h "
28 #include "content/browser/geolocation/location_arbitrator.h" 28 #include "content/browser/geolocation/location_arbitrator.h"
29 #include "content/browser/geolocation/mock_location_provider.h" 29 #include "content/browser/geolocation/mock_location_provider.h"
30 #include "content/browser/renderer_host/render_view_host.h" 30 #include "content/browser/renderer_host/render_view_host.h"
31 #include "content/browser/tab_contents/tab_contents.h"
32 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
33 #include "content/public/browser/notification_details.h" 32 #include "content/public/browser/notification_details.h"
33 #include "content/public/browser/web_contents.h"
34 #include "net/base/net_util.h" 34 #include "net/base/net_util.h"
35 #include "net/test/test_server.h" 35 #include "net/test/test_server.h"
36 36
37 using content::WebContents;
38
37 namespace { 39 namespace {
38 40
39 // Used to block until an iframe is loaded via a javascript call. 41 // Used to block until an iframe is loaded via a javascript call.
40 // Note: NavigateToURLBlockUntilNavigationsComplete doesn't seem to work for 42 // Note: NavigateToURLBlockUntilNavigationsComplete doesn't seem to work for
41 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we 43 // multiple embedded iframes, as notifications seem to be 'batched'. Instead, we
42 // load and wait one single frame here by calling a javascript function. 44 // load and wait one single frame here by calling a javascript function.
43 class IFrameLoader : public content::NotificationObserver { 45 class IFrameLoader : public content::NotificationObserver {
44 public: 46 public:
45 IFrameLoader(Browser* browser, int iframe_id, const GURL& url) 47 IFrameLoader(Browser* browser, int iframe_id, const GURL& url)
46 : navigation_completed_(false), 48 : navigation_completed_(false),
47 javascript_completed_(false) { 49 javascript_completed_(false) {
48 NavigationController* controller = 50 NavigationController* controller =
49 &browser->GetSelectedTabContents()->GetController(); 51 &browser->GetSelectedWebContents()->GetController();
50 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 52 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
51 content::Source<NavigationController>(controller)); 53 content::Source<NavigationController>(controller));
52 registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, 54 registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE,
53 content::NotificationService::AllSources()); 55 content::NotificationService::AllSources());
54 std::string script = base::StringPrintf( 56 std::string script = base::StringPrintf(
55 "window.domAutomationController.setAutomationId(0);" 57 "window.domAutomationController.setAutomationId(0);"
56 "window.domAutomationController.send(addIFrame(%d, \"%s\"));", 58 "window.domAutomationController.send(addIFrame(%d, \"%s\"));",
57 iframe_id, 59 iframe_id,
58 url.spec().c_str()); 60 url.spec().c_str());
59 browser->GetSelectedTabContents()->GetRenderViewHost()-> 61 browser->GetSelectedWebContents()->GetRenderViewHost()->
60 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(script)); 62 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(script));
61 ui_test_utils::RunMessageLoop(); 63 ui_test_utils::RunMessageLoop();
62 64
63 EXPECT_EQ(base::StringPrintf("\"%d\"", iframe_id), javascript_response_); 65 EXPECT_EQ(base::StringPrintf("\"%d\"", iframe_id), javascript_response_);
64 registrar_.RemoveAll(); 66 registrar_.RemoveAll();
65 // Now that we loaded the iframe, let's fetch its src. 67 // Now that we loaded the iframe, let's fetch its src.
66 script = base::StringPrintf( 68 script = base::StringPrintf(
67 "window.domAutomationController.send(getIFrameSrc(%d))", iframe_id); 69 "window.domAutomationController.send(getIFrameSrc(%d))", iframe_id);
68 std::string iframe_src; 70 std::string iframe_src;
69 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 71 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
70 browser->GetSelectedTabContents()->GetRenderViewHost(), 72 browser->GetSelectedWebContents()->GetRenderViewHost(),
71 L"", UTF8ToWide(script), &iframe_src)); 73 L"", UTF8ToWide(script), &iframe_src));
72 iframe_url_ = GURL(iframe_src); 74 iframe_url_ = GURL(iframe_src);
73 } 75 }
74 76
75 GURL iframe_url() const { return iframe_url_; } 77 GURL iframe_url() const { return iframe_url_; }
76 78
77 virtual void Observe(int type, 79 virtual void Observe(int type,
78 const content::NotificationSource& source, 80 const content::NotificationSource& source,
79 const content::NotificationDetails& details) { 81 const content::NotificationDetails& details) {
80 if (type == content::NOTIFICATION_LOAD_STOP) { 82 if (type == content::NOTIFICATION_LOAD_STOP) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 iframe_urls_.resize(number_iframes); 275 iframe_urls_.resize(number_iframes);
274 for (int i = 0; i < number_iframes; ++i) { 276 for (int i = 0; i < number_iframes; ++i) {
275 IFrameLoader loader(current_browser_, i, GURL()); 277 IFrameLoader loader(current_browser_, i, GURL());
276 iframe_urls_[i] = loader.iframe_url(); 278 iframe_urls_[i] = loader.iframe_url();
277 } 279 }
278 } 280 }
279 281
280 void AddGeolocationWatch(bool wait_for_infobar) { 282 void AddGeolocationWatch(bool wait_for_infobar) {
281 GeolocationNotificationObserver notification_observer(wait_for_infobar); 283 GeolocationNotificationObserver notification_observer(wait_for_infobar);
282 notification_observer.AddWatchAndWaitForNotification( 284 notification_observer.AddWatchAndWaitForNotification(
283 current_browser_->GetSelectedTabContents()->GetRenderViewHost(), 285 current_browser_->GetSelectedWebContents()->GetRenderViewHost(),
284 iframe_xpath_); 286 iframe_xpath_);
285 if (wait_for_infobar) { 287 if (wait_for_infobar) {
286 EXPECT_TRUE(notification_observer.infobar_); 288 EXPECT_TRUE(notification_observer.infobar_);
287 infobar_ = notification_observer.infobar_; 289 infobar_ = notification_observer.infobar_;
288 } 290 }
289 } 291 }
290 292
291 Geoposition GeopositionFromLatLong(double latitude, double longitude) { 293 Geoposition GeopositionFromLatLong(double latitude, double longitude) {
292 Geoposition geoposition; 294 Geoposition geoposition;
293 geoposition.latitude = latitude; 295 geoposition.latitude = latitude;
(...skipping 23 matching lines...) Expand all
317 tab_contents_wrapper->content_settings(); 319 tab_contents_wrapper->content_settings();
318 const GeolocationSettingsState& settings_state = 320 const GeolocationSettingsState& settings_state =
319 content_settings->geolocation_settings_state(); 321 content_settings->geolocation_settings_state();
320 size_t state_map_size = settings_state.state_map().size(); 322 size_t state_map_size = settings_state.state_map().size();
321 ASSERT_TRUE(infobar_); 323 ASSERT_TRUE(infobar_);
322 LOG(WARNING) << "will set infobar response"; 324 LOG(WARNING) << "will set infobar response";
323 { 325 {
324 ui_test_utils::WindowedNotificationObserver observer( 326 ui_test_utils::WindowedNotificationObserver observer(
325 content::NOTIFICATION_LOAD_STOP, 327 content::NOTIFICATION_LOAD_STOP,
326 content::Source<NavigationController>( 328 content::Source<NavigationController>(
327 &tab_contents_wrapper->tab_contents()->GetController())); 329 &tab_contents_wrapper->web_contents()->GetController()));
328 if (allowed) 330 if (allowed)
329 infobar_->AsConfirmInfoBarDelegate()->Accept(); 331 infobar_->AsConfirmInfoBarDelegate()->Accept();
330 else 332 else
331 infobar_->AsConfirmInfoBarDelegate()->Cancel(); 333 infobar_->AsConfirmInfoBarDelegate()->Cancel();
332 observer.Wait(); 334 observer.Wait();
333 } 335 }
334 336
335 tab_contents_wrapper->infobar_tab_helper()->RemoveInfoBar(infobar_); 337 tab_contents_wrapper->infobar_tab_helper()->RemoveInfoBar(infobar_);
336 LOG(WARNING) << "infobar response set"; 338 LOG(WARNING) << "infobar response set";
337 infobar_ = NULL; 339 infobar_ = NULL;
338 EXPECT_GT(settings_state.state_map().size(), state_map_size); 340 EXPECT_GT(settings_state.state_map().size(), state_map_size);
339 GURL requesting_origin = requesting_url.GetOrigin(); 341 GURL requesting_origin = requesting_url.GetOrigin();
340 EXPECT_EQ(1U, settings_state.state_map().count(requesting_origin)); 342 EXPECT_EQ(1U, settings_state.state_map().count(requesting_origin));
341 ContentSetting expected_setting = 343 ContentSetting expected_setting =
342 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; 344 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
343 EXPECT_EQ(expected_setting, 345 EXPECT_EQ(expected_setting,
344 settings_state.state_map().find(requesting_origin)->second); 346 settings_state.state_map().find(requesting_origin)->second);
345 } 347 }
346 348
347 void CheckStringValueFromJavascriptForTab( 349 void CheckStringValueFromJavascriptForTab(
348 const std::string& expected, const std::string& function, 350 const std::string& expected, const std::string& function,
349 TabContents* tab_contents) { 351 WebContents* web_contents) {
350 std::string script = base::StringPrintf( 352 std::string script = base::StringPrintf(
351 "window.domAutomationController.send(%s)", function.c_str()); 353 "window.domAutomationController.send(%s)", function.c_str());
352 std::string result; 354 std::string result;
353 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 355 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
354 tab_contents->GetRenderViewHost(), 356 web_contents->GetRenderViewHost(),
355 iframe_xpath_, UTF8ToWide(script), &result)); 357 iframe_xpath_, UTF8ToWide(script), &result));
356 EXPECT_EQ(expected, result); 358 EXPECT_EQ(expected, result);
357 } 359 }
358 360
359 void CheckStringValueFromJavascript( 361 void CheckStringValueFromJavascript(
360 const std::string& expected, const std::string& function) { 362 const std::string& expected, const std::string& function) {
361 CheckStringValueFromJavascriptForTab( 363 CheckStringValueFromJavascriptForTab(
362 expected, function, current_browser_->GetSelectedTabContents()); 364 expected, function, current_browser_->GetSelectedWebContents());
363 } 365 }
364 366
365 InfoBarDelegate* infobar_; 367 InfoBarDelegate* infobar_;
366 Browser* current_browser_; 368 Browser* current_browser_;
367 // path element of a URL referencing the html content for this test. 369 // path element of a URL referencing the html content for this test.
368 std::string html_for_tests_; 370 std::string html_for_tests_;
369 // This member defines the iframe (or top-level page, if empty) where the 371 // This member defines the iframe (or top-level page, if empty) where the
370 // javascript calls will run. 372 // javascript calls will run.
371 std::wstring iframe_xpath_; 373 std::wstring iframe_xpath_;
372 // The current url for the top level page. 374 // The current url for the top level page.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 502
501 // Back to the first frame, enable navigation and refresh geoposition. 503 // Back to the first frame, enable navigation and refresh geoposition.
502 iframe_xpath_ = L"//iframe[@id='iframe_0']"; 504 iframe_xpath_ = L"//iframe[@id='iframe_0']";
503 CheckStringValueFromJavascript("1", "geoSetMaxNavigateCount(1)"); 505 CheckStringValueFromJavascript("1", "geoSetMaxNavigateCount(1)");
504 // MockLocationProvider must have been created. 506 // MockLocationProvider must have been created.
505 ASSERT_TRUE(MockLocationProvider::instance_); 507 ASSERT_TRUE(MockLocationProvider::instance_);
506 Geoposition fresh_position = GeopositionFromLatLong(3.17, 4.23); 508 Geoposition fresh_position = GeopositionFromLatLong(3.17, 4.23);
507 ui_test_utils::WindowedNotificationObserver observer( 509 ui_test_utils::WindowedNotificationObserver observer(
508 content::NOTIFICATION_LOAD_STOP, 510 content::NOTIFICATION_LOAD_STOP,
509 content::Source<NavigationController>( 511 content::Source<NavigationController>(
510 &current_browser_->GetSelectedTabContents()->GetController())); 512 &current_browser_->GetSelectedWebContents()->GetController()));
511 NotifyGeoposition(fresh_position); 513 NotifyGeoposition(fresh_position);
512 observer.Wait(); 514 observer.Wait();
513 CheckGeoposition(fresh_position); 515 CheckGeoposition(fresh_position);
514 516
515 // Disable navigation for this frame. 517 // Disable navigation for this frame.
516 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)"); 518 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)");
517 519
518 // Now go ahead an authorize the second frame. 520 // Now go ahead an authorize the second frame.
519 iframe_xpath_ = L"//iframe[@id='iframe_1']"; 521 iframe_xpath_ = L"//iframe[@id='iframe_1']";
520 // Infobar was displayed, allow access and check there's no error code. 522 // Infobar was displayed, allow access and check there's no error code.
(...skipping 16 matching lines...) Expand all
537 CheckGeoposition(MockLocationProvider::instance_->position_); 539 CheckGeoposition(MockLocationProvider::instance_->position_);
538 540
539 // Refresh geoposition, but let's not yet create the watch on the second frame 541 // Refresh geoposition, but let's not yet create the watch on the second frame
540 // so that it'll fetch from cache. 542 // so that it'll fetch from cache.
541 // MockLocationProvider must have been created. 543 // MockLocationProvider must have been created.
542 ASSERT_TRUE(MockLocationProvider::instance_); 544 ASSERT_TRUE(MockLocationProvider::instance_);
543 Geoposition cached_position = GeopositionFromLatLong(5.67, 8.09); 545 Geoposition cached_position = GeopositionFromLatLong(5.67, 8.09);
544 ui_test_utils::WindowedNotificationObserver observer( 546 ui_test_utils::WindowedNotificationObserver observer(
545 content::NOTIFICATION_LOAD_STOP, 547 content::NOTIFICATION_LOAD_STOP,
546 content::Source<NavigationController>( 548 content::Source<NavigationController>(
547 &current_browser_->GetSelectedTabContents()->GetController())); 549 &current_browser_->GetSelectedWebContents()->GetController()));
548 NotifyGeoposition(cached_position); 550 NotifyGeoposition(cached_position);
549 observer.Wait(); 551 observer.Wait();
550 CheckGeoposition(cached_position); 552 CheckGeoposition(cached_position);
551 553
552 // Disable navigation for this frame. 554 // Disable navigation for this frame.
553 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)"); 555 CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)");
554 556
555 // Now go ahead an authorize the second frame. 557 // Now go ahead an authorize the second frame.
556 iframe_xpath_ = L"//iframe[@id='iframe_1']"; 558 iframe_xpath_ = L"//iframe[@id='iframe_1']";
557 AddGeolocationWatch(true); 559 AddGeolocationWatch(true);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 size_t num_infobars_after_cancel = infobar_helper->infobar_count(); 593 size_t num_infobars_after_cancel = infobar_helper->infobar_count();
592 EXPECT_EQ(num_infobars_before_cancel, num_infobars_after_cancel + 1); 594 EXPECT_EQ(num_infobars_before_cancel, num_infobars_after_cancel + 1);
593 } 595 }
594 596
595 // Disabled, http://crbug.com/66959. 597 // Disabled, http://crbug.com/66959.
596 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_InvalidUrlRequest) { 598 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_InvalidUrlRequest) {
597 // Tests that an invalid URL (e.g. from a popup window) is rejected 599 // Tests that an invalid URL (e.g. from a popup window) is rejected
598 // correctly. Also acts as a regression test for http://crbug.com/40478 600 // correctly. Also acts as a regression test for http://crbug.com/40478
599 html_for_tests_ = "files/geolocation/invalid_request_url.html"; 601 html_for_tests_ = "files/geolocation/invalid_request_url.html";
600 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); 602 ASSERT_TRUE(Initialize(INITIALIZATION_NONE));
601 TabContents* original_tab = current_browser_->GetSelectedTabContents(); 603 WebContents* original_tab = current_browser_->GetSelectedWebContents();
602 CheckStringValueFromJavascript("1", "requestGeolocationFromInvalidUrl()"); 604 CheckStringValueFromJavascript("1", "requestGeolocationFromInvalidUrl()");
603 CheckStringValueFromJavascriptForTab("1", "isAlive()", original_tab); 605 CheckStringValueFromJavascriptForTab("1", "isAlive()", original_tab);
604 } 606 }
605 607
606 // Crashy, http://crbug.com/66400. 608 // Crashy, http://crbug.com/66400.
607 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_NoInfoBarBeforeStart) { 609 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_NoInfoBarBeforeStart) {
608 // See http://crbug.com/42789 610 // See http://crbug.com/42789
609 html_for_tests_ = "files/geolocation/iframes_different_origin.html"; 611 html_for_tests_ = "files/geolocation/iframes_different_origin.html";
610 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); 612 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES));
611 LoadIFrames(2); 613 LoadIFrames(2);
(...skipping 19 matching lines...) Expand all
631 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TwoWatchesInOneFrame) { 633 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TwoWatchesInOneFrame) {
632 html_for_tests_ = "files/geolocation/two_watches.html"; 634 html_for_tests_ = "files/geolocation/two_watches.html";
633 ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); 635 ASSERT_TRUE(Initialize(INITIALIZATION_NONE));
634 // First, set the JavaScript to navigate when it receives |final_position|. 636 // First, set the JavaScript to navigate when it receives |final_position|.
635 const Geoposition final_position = GeopositionFromLatLong(3.17, 4.23); 637 const Geoposition final_position = GeopositionFromLatLong(3.17, 4.23);
636 std::string script = base::StringPrintf( 638 std::string script = base::StringPrintf(
637 "window.domAutomationController.send(geoSetFinalPosition(%f, %f))", 639 "window.domAutomationController.send(geoSetFinalPosition(%f, %f))",
638 final_position.latitude, final_position.longitude); 640 final_position.latitude, final_position.longitude);
639 std::string js_result; 641 std::string js_result;
640 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 642 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
641 current_browser_->GetSelectedTabContents()->GetRenderViewHost(), 643 current_browser_->GetSelectedWebContents()->GetRenderViewHost(),
642 L"", UTF8ToWide(script), &js_result)); 644 L"", UTF8ToWide(script), &js_result));
643 EXPECT_EQ(js_result, "ok"); 645 EXPECT_EQ(js_result, "ok");
644 646
645 // Send a position which both geolocation watches will receive. 647 // Send a position which both geolocation watches will receive.
646 AddGeolocationWatch(true); 648 AddGeolocationWatch(true);
647 SetInfobarResponse(current_url_, true); 649 SetInfobarResponse(current_url_, true);
648 CheckGeoposition(MockLocationProvider::instance_->position_); 650 CheckGeoposition(MockLocationProvider::instance_->position_);
649 651
650 // The second watch will now have cancelled. Ensure an update still makes 652 // The second watch will now have cancelled. Ensure an update still makes
651 // its way through to the first watcher. 653 // its way through to the first watcher.
652 ui_test_utils::WindowedNotificationObserver observer( 654 ui_test_utils::WindowedNotificationObserver observer(
653 content::NOTIFICATION_LOAD_STOP, 655 content::NOTIFICATION_LOAD_STOP,
654 content::Source<NavigationController>( 656 content::Source<NavigationController>(
655 &current_browser_->GetSelectedTabContents()->GetController())); 657 &current_browser_->GetSelectedWebContents()->GetController()));
656 NotifyGeoposition(final_position); 658 NotifyGeoposition(final_position);
657 observer.Wait(); 659 observer.Wait();
658 CheckGeoposition(final_position); 660 CheckGeoposition(final_position);
659 } 661 }
660 662
661 // Hangs flakily, http://crbug.com/70588. 663 // Hangs flakily, http://crbug.com/70588.
662 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_TabDestroyed) { 664 IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_TabDestroyed) {
663 html_for_tests_ = "files/geolocation/tab_destroyed.html"; 665 html_for_tests_ = "files/geolocation/tab_destroyed.html";
664 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES)); 666 ASSERT_TRUE(Initialize(INITIALIZATION_IFRAMES));
665 LoadIFrames(3); 667 LoadIFrames(3);
666 668
667 iframe_xpath_ = L"//iframe[@id='iframe_0']"; 669 iframe_xpath_ = L"//iframe[@id='iframe_0']";
668 AddGeolocationWatch(true); 670 AddGeolocationWatch(true);
669 671
670 iframe_xpath_ = L"//iframe[@id='iframe_1']"; 672 iframe_xpath_ = L"//iframe[@id='iframe_1']";
671 AddGeolocationWatch(false); 673 AddGeolocationWatch(false);
672 674
673 iframe_xpath_ = L"//iframe[@id='iframe_2']"; 675 iframe_xpath_ = L"//iframe[@id='iframe_2']";
674 AddGeolocationWatch(false); 676 AddGeolocationWatch(false);
675 677
676 std::string script = 678 std::string script =
677 "window.domAutomationController.setAutomationId(0);" 679 "window.domAutomationController.setAutomationId(0);"
678 "window.domAutomationController.send(window.close());"; 680 "window.domAutomationController.send(window.close());";
679 bool result = 681 bool result =
680 ui_test_utils::ExecuteJavaScript( 682 ui_test_utils::ExecuteJavaScript(
681 current_browser_->GetSelectedTabContents()->GetRenderViewHost(), 683 current_browser_->GetSelectedWebContents()->GetRenderViewHost(),
682 L"", UTF8ToWide(script)); 684 L"", UTF8ToWide(script));
683 EXPECT_EQ(result, true); 685 EXPECT_EQ(result, true);
684 } 686 }
685 687
686 } // namespace 688 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/gpu_pixel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698