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

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

Issue 11734018: Revert 174880 due to compilation error in pdf_browsertest.cc (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1374/src/
Patch Set: Created 7 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
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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 546 }
547 547
548 void ExtensionBrowserTest::OpenWindow(content::WebContents* contents, 548 void ExtensionBrowserTest::OpenWindow(content::WebContents* contents,
549 const GURL& url, 549 const GURL& url,
550 bool newtab_process_should_equal_opener, 550 bool newtab_process_should_equal_opener,
551 content::WebContents** newtab_result) { 551 content::WebContents** newtab_result) {
552 content::WindowedNotificationObserver observer( 552 content::WindowedNotificationObserver observer(
553 content::NOTIFICATION_LOAD_STOP, 553 content::NOTIFICATION_LOAD_STOP,
554 content::NotificationService::AllSources()); 554 content::NotificationService::AllSources());
555 ASSERT_TRUE(content::ExecuteJavaScript( 555 ASSERT_TRUE(content::ExecuteJavaScript(
556 contents->GetRenderViewHost(), 556 contents->GetRenderViewHost(), L"",
557 "", 557 L"window.open('" + UTF8ToWide(url.spec()) + L"');"));
558 "window.open('" + url.spec() + "');"));
559 558
560 // The above window.open call is not user-initiated, so it will create 559 // The above window.open call is not user-initiated, so it will create
561 // a popup window instead of a new tab in current window. 560 // a popup window instead of a new tab in current window.
562 // The stop notification will come from the new tab. 561 // The stop notification will come from the new tab.
563 observer.Wait(); 562 observer.Wait();
564 content::NavigationController* controller = 563 content::NavigationController* controller =
565 content::Source<content::NavigationController>(observer.source()).ptr(); 564 content::Source<content::NavigationController>(observer.source()).ptr();
566 content::WebContents* newtab = controller->GetWebContents(); 565 content::WebContents* newtab = controller->GetWebContents();
567 ASSERT_TRUE(newtab); 566 ASSERT_TRUE(newtab);
568 EXPECT_EQ(url, controller->GetLastCommittedEntry()->GetURL()); 567 EXPECT_EQ(url, controller->GetLastCommittedEntry()->GetURL());
569 if (newtab_process_should_equal_opener) 568 if (newtab_process_should_equal_opener)
570 EXPECT_EQ(contents->GetRenderProcessHost(), newtab->GetRenderProcessHost()); 569 EXPECT_EQ(contents->GetRenderProcessHost(), newtab->GetRenderProcessHost());
571 else 570 else
572 EXPECT_NE(contents->GetRenderProcessHost(), newtab->GetRenderProcessHost()); 571 EXPECT_NE(contents->GetRenderProcessHost(), newtab->GetRenderProcessHost());
573 572
574 if (newtab_result) 573 if (newtab_result)
575 *newtab_result = newtab; 574 *newtab_result = newtab;
576 } 575 }
577 576
578 void ExtensionBrowserTest::NavigateInRenderer(content::WebContents* contents, 577 void ExtensionBrowserTest::NavigateInRenderer(content::WebContents* contents,
579 const GURL& url) { 578 const GURL& url) {
580 bool result = false; 579 bool result = false;
581 content::WindowedNotificationObserver observer( 580 content::WindowedNotificationObserver observer(
582 content::NOTIFICATION_LOAD_STOP, 581 content::NOTIFICATION_LOAD_STOP,
583 content::NotificationService::AllSources()); 582 content::NotificationService::AllSources());
584 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 583 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
585 contents->GetRenderViewHost(), 584 contents->GetRenderViewHost(), L"",
586 "", 585 L"window.addEventListener('unload', function() {"
587 "window.addEventListener('unload', function() {" 586 L" window.domAutomationController.send(true);"
588 " window.domAutomationController.send(true);" 587 L"}, false);"
589 "}, false);" 588 L"window.location = '" + UTF8ToWide(url.spec()) + L"';",
590 "window.location = '" + url.spec() + "';",
591 &result)); 589 &result));
592 ASSERT_TRUE(result); 590 ASSERT_TRUE(result);
593 observer.Wait(); 591 observer.Wait();
594 EXPECT_EQ(url, contents->GetController().GetLastCommittedEntry()->GetURL()); 592 EXPECT_EQ(url, contents->GetController().GetLastCommittedEntry()->GetURL());
595 } 593 }
596 594
597 extensions::ExtensionHost* ExtensionBrowserTest::FindHostWithPath( 595 extensions::ExtensionHost* ExtensionBrowserTest::FindHostWithPath(
598 ExtensionProcessManager* manager, 596 ExtensionProcessManager* manager,
599 const std::string& path, 597 const std::string& path,
600 int expected_hosts) { 598 int expected_hosts) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 case content::NOTIFICATION_LOAD_STOP: 690 case content::NOTIFICATION_LOAD_STOP:
693 VLOG(1) << "Got LOAD_STOP notification."; 691 VLOG(1) << "Got LOAD_STOP notification.";
694 MessageLoopForUI::current()->Quit(); 692 MessageLoopForUI::current()->Quit();
695 break; 693 break;
696 694
697 default: 695 default:
698 NOTREACHED(); 696 NOTREACHED();
699 break; 697 break;
700 } 698 }
701 } 699 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_bindings_apitest.cc ('k') | chrome/browser/extensions/extension_dom_clipboard_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698