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

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

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/extensions/extension_tab_util.h" 6 #include "chrome/browser/extensions/extension_tab_util.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" 8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
10 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 options_in_tab->GetResourceURL("other.html")); 76 options_in_tab->GetResourceURL("other.html"));
77 EXPECT_TRUE(ExtensionTabUtil::OpenOptionsPage(options_in_tab, browser())); 77 EXPECT_TRUE(ExtensionTabUtil::OpenOptionsPage(options_in_tab, browser()));
78 EXPECT_EQ(3, browser()->tab_strip_model()->count()); 78 EXPECT_EQ(3, browser()->tab_strip_model()->count());
79 EXPECT_TRUE(content::WaitForLoadStop( 79 EXPECT_TRUE(content::WaitForLoadStop(
80 browser()->tab_strip_model()->GetActiveWebContents())); 80 browser()->tab_strip_model()->GetActiveWebContents()));
81 EXPECT_EQ(options_url, GetActiveUrl(browser())); 81 EXPECT_EQ(options_url, GetActiveUrl(browser()));
82 82
83 // If the user navigates to the options page e.g. by typing in the url, it 83 // If the user navigates to the options page e.g. by typing in the url, it
84 // should not override the currently-open tab. 84 // should not override the currently-open tab.
85 ui_test_utils::NavigateToURLWithDisposition( 85 ui_test_utils::NavigateToURLWithDisposition(
86 browser(), 86 browser(), options_url, WindowOpenDisposition::NEW_FOREGROUND_TAB,
87 options_url,
88 NEW_FOREGROUND_TAB,
89 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 87 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
90 EXPECT_EQ(4, browser()->tab_strip_model()->count()); 88 EXPECT_EQ(4, browser()->tab_strip_model()->count());
91 EXPECT_EQ(options_url, GetActiveUrl(browser())); 89 EXPECT_EQ(options_url, GetActiveUrl(browser()));
92 90
93 // Test the extension that has the options page open in a view inside 91 // Test the extension that has the options page open in a view inside
94 // chrome://extensions. 92 // chrome://extensions.
95 // Triggering OpenOptionsPage() should create a new tab, since there are none 93 // Triggering OpenOptionsPage() should create a new tab, since there are none
96 // to override. 94 // to override.
97 options_url = GURL("chrome://extensions/?options=" + options_in_view->id()); 95 options_url = GURL("chrome://extensions/?options=" + options_in_view->id());
98 EXPECT_TRUE(ExtensionTabUtil::OpenOptionsPage(options_in_view, browser())); 96 EXPECT_TRUE(ExtensionTabUtil::OpenOptionsPage(options_in_view, browser()));
(...skipping 14 matching lines...) Expand all
113 // should override that tab rather than opening a new tab. crbug.com/595253. 111 // should override that tab rather than opening a new tab. crbug.com/595253.
114 ui_test_utils::NavigateToURL(browser(), GURL("chrome://extensions")); 112 ui_test_utils::NavigateToURL(browser(), GURL("chrome://extensions"));
115 EXPECT_TRUE(ExtensionTabUtil::OpenOptionsPage(options_in_view, browser())); 113 EXPECT_TRUE(ExtensionTabUtil::OpenOptionsPage(options_in_view, browser()));
116 EXPECT_EQ(5, browser()->tab_strip_model()->count()); 114 EXPECT_EQ(5, browser()->tab_strip_model()->count());
117 EXPECT_TRUE(content::WaitForLoadStop( 115 EXPECT_TRUE(content::WaitForLoadStop(
118 browser()->tab_strip_model()->GetActiveWebContents())); 116 browser()->tab_strip_model()->GetActiveWebContents()));
119 EXPECT_EQ(options_url, GetActiveUrl(browser())); 117 EXPECT_EQ(options_url, GetActiveUrl(browser()));
120 } 118 }
121 119
122 } // namespace extensions 120 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_util.cc ('k') | chrome/browser/extensions/extension_uninstall_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698