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

Side by Side Diff: chrome/browser/extensions/extension_browsertest.cc

Issue 1475863005: [Async][WIP] Call FrameLoader::checkCompleted() asynchronously to avoid sync body.onload() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 10 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
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.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) 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 "chrome/browser/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 profile())->extension_service(); 580 profile())->extension_service();
581 service->EnableExtension(extension_id); 581 service->EnableExtension(extension_id);
582 } 582 }
583 583
584 void ExtensionBrowserTest::OpenWindow(content::WebContents* contents, 584 void ExtensionBrowserTest::OpenWindow(content::WebContents* contents,
585 const GURL& url, 585 const GURL& url,
586 bool newtab_process_should_equal_opener, 586 bool newtab_process_should_equal_opener,
587 content::WebContents** newtab_result) { 587 content::WebContents** newtab_result) {
588 content::WindowedNotificationObserver windowed_observer( 588 content::WindowedNotificationObserver windowed_observer(
589 content::NOTIFICATION_LOAD_STOP, 589 content::NOTIFICATION_LOAD_STOP,
590 content::NotificationService::AllSources()); 590 content::Source<content::NavigationController>(&contents->GetController()) );
591 ASSERT_TRUE(content::ExecuteScript(contents, 591 ASSERT_TRUE(content::ExecuteScript(contents,
592 "window.open('" + url.spec() + "');")); 592 "window.open('" + url.spec() + "');"));
593 593
594 // The above window.open call is not user-initiated, so it will create 594 // The above window.open call is not user-initiated, so it will create
595 // a popup window instead of a new tab in current window. 595 // a popup window instead of a new tab in current window.
596 // The stop notification will come from the new tab. 596 // The stop notification will come from the new tab.
597 windowed_observer.Wait(); 597 windowed_observer.Wait();
598 content::NavigationController* controller = 598 content::NavigationController* controller =
599 content::Source<content::NavigationController>( 599 content::Source<content::NavigationController>(
600 windowed_observer.source()).ptr(); 600 windowed_observer.source()).ptr();
(...skipping 10 matching lines...) Expand all
611 } 611 }
612 612
613 void ExtensionBrowserTest::NavigateInRenderer(content::WebContents* contents, 613 void ExtensionBrowserTest::NavigateInRenderer(content::WebContents* contents,
614 const GURL& url) { 614 const GURL& url) {
615 // Ensure any existing navigations complete before trying to navigate anew, to 615 // Ensure any existing navigations complete before trying to navigate anew, to
616 // avoid triggering of the unload event for the wrong navigation. 616 // avoid triggering of the unload event for the wrong navigation.
617 content::WaitForLoadStop(contents); 617 content::WaitForLoadStop(contents);
618 bool result = false; 618 bool result = false;
619 content::WindowedNotificationObserver windowed_observer( 619 content::WindowedNotificationObserver windowed_observer(
620 content::NOTIFICATION_LOAD_STOP, 620 content::NOTIFICATION_LOAD_STOP,
621 content::NotificationService::AllSources()); 621 content::Source<content::NavigationController>(&contents->GetController()) );
622 //content::NotificationService::AllSources());
622 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 623 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
623 contents, 624 contents,
624 "window.addEventListener('unload', function() {" 625 "window.addEventListener('unload', function() {"
625 " window.domAutomationController.send(true);" 626 " window.domAutomationController.send(true);"
626 "}, false);" 627 "}, false);"
627 "window.location = '" + url.spec() + "';", 628 "window.location = '" + url.spec() + "';",
628 &result)); 629 &result));
629 ASSERT_TRUE(result); 630 ASSERT_TRUE(result);
630 windowed_observer.Wait(); 631 windowed_observer.Wait();
631 EXPECT_EQ(url, contents->GetController().GetLastCommittedEntry()->GetURL()); 632 EXPECT_EQ(url, contents->GetController().GetLastCommittedEntry()->GetURL());
(...skipping 22 matching lines...) Expand all
654 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( 655 return extensions::browsertest_util::ExecuteScriptInBackgroundPage(
655 profile(), extension_id, script); 656 profile(), extension_id, script);
656 } 657 }
657 658
658 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( 659 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait(
659 const std::string& extension_id, 660 const std::string& extension_id,
660 const std::string& script) { 661 const std::string& script) {
661 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( 662 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait(
662 profile(), extension_id, script); 663 profile(), extension_id, script);
663 } 664 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698