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

Unified Diff: chrome/browser/extensions/extension_browsertest.cc

Issue 2830893002: Refactor of ExtensionNavigationThrottle (Closed)
Patch Set: \ Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_navigation_throttle_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_browsertest.cc
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index 1ddcbdf0c3b192a65ad5b8b10cc0fb8c2048c338..e76e4ff3d9443f134f3ee5d60ededc3d7ff0344e 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -48,6 +48,7 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
@@ -540,26 +541,20 @@ void ExtensionBrowserTest::OpenWindow(content::WebContents* contents,
const GURL& url,
bool newtab_process_should_equal_opener,
content::WebContents** newtab_result) {
- content::WindowedNotificationObserver windowed_observer(
- content::NOTIFICATION_LOAD_STOP,
- content::NotificationService::AllSources());
+ content::WebContentsAddedObserver tab_added_observer;
ASSERT_TRUE(content::ExecuteScript(contents,
"window.open('" + url.spec() + "');"));
-
- // The above window.open call is not user-initiated, so it will create
- // a popup window instead of a new tab in current window.
- // The stop notification will come from the new tab.
- windowed_observer.Wait();
- content::NavigationController* controller =
- content::Source<content::NavigationController>(
- windowed_observer.source()).ptr();
- content::WebContents* newtab = controller->GetWebContents();
+ content::WebContents* newtab = tab_added_observer.GetWebContents();
ASSERT_TRUE(newtab);
- EXPECT_EQ(url, controller->GetLastCommittedEntry()->GetURL());
- if (newtab_process_should_equal_opener)
- EXPECT_EQ(contents->GetRenderProcessHost(), newtab->GetRenderProcessHost());
- else
- EXPECT_NE(contents->GetRenderProcessHost(), newtab->GetRenderProcessHost());
+ WaitForLoadStop(newtab);
+ EXPECT_EQ(url, newtab->GetLastCommittedURL());
+ if (newtab_process_should_equal_opener) {
+ EXPECT_EQ(contents->GetMainFrame()->GetSiteInstance(),
+ newtab->GetMainFrame()->GetSiteInstance());
+ } else {
+ EXPECT_NE(contents->GetMainFrame()->GetSiteInstance(),
+ newtab->GetMainFrame()->GetSiteInstance());
+ }
if (newtab_result)
*newtab_result = newtab;
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_navigation_throttle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698