Commit 7266b6ea authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

CustomTabBarViewBrowserTest stores GetURL results by value

Calls like https_server()->GetURL("app.com", "/ssl/google.html")
generate GURL values. We now store such values by value
instead of by reference.

Bug: 1136278
Change-Id: I1267e9bdf77c062d1ae83c6dc231dc4dc3b7da6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459546Reviewed-by: default avatarCaroline Rising <corising@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815144}
parent 8578a5a4
...@@ -215,11 +215,11 @@ class CustomTabBarViewBrowserTest ...@@ -215,11 +215,11 @@ class CustomTabBarViewBrowserTest
Install(std::move(web_app_info)); Install(std::move(web_app_info));
} }
Browser* app_browser_;
BrowserView* browser_view_; BrowserView* browser_view_;
LocationBarView* location_bar_; LocationBarView* location_bar_;
CustomTabBarView* custom_tab_bar_; CustomTabBarView* custom_tab_bar_;
web_app::AppBrowserController* app_controller_; Browser* app_browser_ = nullptr;
web_app::AppBrowserController* app_controller_ = nullptr;
private: private:
void Install(std::unique_ptr<WebApplicationInfo> web_app_info) { void Install(std::unique_ptr<WebApplicationInfo> web_app_info) {
...@@ -271,8 +271,8 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsNotCreatedInPopup) { ...@@ -271,8 +271,8 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsNotCreatedInPopup) {
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
BackToAppButtonIsNotVisibleInOutOfScopePopups) { BackToAppButtonIsNotVisibleInOutOfScopePopups) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
const GURL& out_of_scope_url = GURL("https://example.com"); const GURL out_of_scope_url = GURL("https://example.com");
InstallBookmark(app_url); InstallBookmark(app_url);
EXPECT_TRUE(app_browser_->is_type_app()); EXPECT_TRUE(app_browser_->is_type_app());
...@@ -298,7 +298,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -298,7 +298,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsUsedForDesktopPWA) { IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsUsedForDesktopPWA) {
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
const GURL& url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL url = https_server()->GetURL("app.com", "/ssl/google.html");
InstallPWA(url); InstallPWA(url);
EXPECT_TRUE(app_browser_); EXPECT_TRUE(app_browser_);
...@@ -318,7 +318,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsUsedForDesktopPWA) { ...@@ -318,7 +318,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsUsedForDesktopPWA) {
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ShowsWithMixedContent) { IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ShowsWithMixedContent) {
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
const GURL& url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL url = https_server()->GetURL("app.com", "/ssl/google.html");
InstallPWA(url); InstallPWA(url);
ASSERT_TRUE(app_browser_); ASSERT_TRUE(app_browser_);
...@@ -345,11 +345,11 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ShowsWithMixedContent) { ...@@ -345,11 +345,11 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ShowsWithMixedContent) {
// The custom tab bar should update with the title and location of the current // The custom tab bar should update with the title and location of the current
// page. // page.
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, TitleAndLocationUpdate) { IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, TitleAndLocationUpdate) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
// This url is out of scope, because the CustomTabBar is not updated when it // This url is out of scope, because the CustomTabBar is not updated when it
// is not shown. // is not shown.
const GURL& navigate_to = https_server()->GetURL("app.com", "/simple.html"); const GURL navigate_to = https_server()->GetURL("app.com", "/simple.html");
InstallPWA(app_url); InstallPWA(app_url);
...@@ -373,7 +373,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, TitleAndLocationUpdate) { ...@@ -373,7 +373,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, TitleAndLocationUpdate) {
// If the page doesn't specify a title, we should use the origin. // If the page doesn't specify a title, we should use the origin.
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
UsesLocationInsteadOfEmptyTitles) { UsesLocationInsteadOfEmptyTitles) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
InstallPWA(app_url); InstallPWA(app_url);
EXPECT_TRUE(app_browser_); EXPECT_TRUE(app_browser_);
...@@ -394,7 +394,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -394,7 +394,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
// Closing the CCT should take you back to the last in scope url. // Closing the CCT should take you back to the last in scope url.
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
OutOfScopeUrlShouldBeClosable) { OutOfScopeUrlShouldBeClosable) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
InstallPWA(app_url); InstallPWA(app_url);
EXPECT_TRUE(app_browser_); EXPECT_TRUE(app_browser_);
...@@ -405,7 +405,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -405,7 +405,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
EXPECT_NE(app_view, browser_view_); EXPECT_NE(app_view, browser_view_);
// Perform an inscope navigation. // Perform an inscope navigation.
const GURL& other_app_url = const GURL other_app_url =
https_server()->GetURL("app.com", "/ssl/blank_page.html"); https_server()->GetURL("app.com", "/ssl/blank_page.html");
NavigateAndWait(web_contents, other_app_url); NavigateAndWait(web_contents, other_app_url);
EXPECT_FALSE(app_controller_->ShouldShowCustomTabBar()); EXPECT_FALSE(app_controller_->ShouldShowCustomTabBar());
...@@ -432,7 +432,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -432,7 +432,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
#endif #endif
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
MAYBE_RightClickMenuShowsCopyUrl) { MAYBE_RightClickMenuShowsCopyUrl) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
InstallPWA(app_url); InstallPWA(app_url);
EXPECT_TRUE(app_browser_->is_type_app()); EXPECT_TRUE(app_browser_->is_type_app());
...@@ -465,7 +465,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -465,7 +465,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
// the CustomTabBar. // the CustomTabBar.
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
ScopeAboveLaunchURLShouldBeOutOfScopeAndClosable) { ScopeAboveLaunchURLShouldBeOutOfScopeAndClosable) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
InstallPWA(app_url); InstallPWA(app_url);
EXPECT_TRUE(app_browser_); EXPECT_TRUE(app_browser_);
...@@ -477,7 +477,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -477,7 +477,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
// Navigate to a different page in the app scope, so we have something to come // Navigate to a different page in the app scope, so we have something to come
// back to. // back to.
const GURL& other_app_url = const GURL other_app_url =
https_server()->GetURL("app.com", "/ssl/blank_page.html"); https_server()->GetURL("app.com", "/ssl/blank_page.html");
NavigateAndWait(web_contents, other_app_url); NavigateAndWait(web_contents, other_app_url);
EXPECT_FALSE(app_controller_->ShouldShowCustomTabBar()); EXPECT_FALSE(app_controller_->ShouldShowCustomTabBar());
...@@ -501,7 +501,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -501,7 +501,7 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P( IN_PROC_BROWSER_TEST_P(
CustomTabBarViewBrowserTest, CustomTabBarViewBrowserTest,
WhenNoHistoryIsInScopeCloseShouldNavigateToAppLaunchURL) { WhenNoHistoryIsInScopeCloseShouldNavigateToAppLaunchURL) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
InstallPWA(app_url); InstallPWA(app_url);
EXPECT_TRUE(app_browser_); EXPECT_TRUE(app_browser_);
...@@ -532,8 +532,8 @@ IN_PROC_BROWSER_TEST_P( ...@@ -532,8 +532,8 @@ IN_PROC_BROWSER_TEST_P(
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
OriginsWithEmojiArePunyCoded) { OriginsWithEmojiArePunyCoded) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
const GURL& navigate_to = GURL("https://🔒.example/ssl/blank_page.html"); const GURL navigate_to = GURL("https://🔒.example/ssl/blank_page.html");
InstallPWA(app_url); InstallPWA(app_url);
...@@ -554,8 +554,8 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -554,8 +554,8 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
OriginsWithNonASCIICharactersDisplayNormally) { OriginsWithNonASCIICharactersDisplayNormally) {
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html"); const GURL app_url = https_server()->GetURL("app.com", "/ssl/google.html");
const GURL& navigate_to = GURL("https://ΐ.example/ssl/blank_page.html"); const GURL navigate_to = GURL("https://ΐ.example/ssl/blank_page.html");
InstallPWA(app_url); InstallPWA(app_url);
...@@ -581,9 +581,9 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -581,9 +581,9 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
// We install over http because it's the easiest way to get a custom tab bar // We install over http because it's the easiest way to get a custom tab bar
// in scope. A PWA won't be installed over http in the real world (it'd make a // in scope. A PWA won't be installed over http in the real world (it'd make a
// shortcut app instead). // shortcut app instead).
const GURL& app_url = const GURL app_url =
embedded_test_server()->GetURL("app.com", "/ssl/google.html"); embedded_test_server()->GetURL("app.com", "/ssl/google.html");
const GURL& out_of_scope_url = GURL("https://example.com"); const GURL out_of_scope_url = GURL("https://example.com");
InstallPWA(app_url); InstallPWA(app_url);
...@@ -630,9 +630,9 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, ...@@ -630,9 +630,9 @@ IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
BackToAppButtonIsNotVisibleInBookmarkAppOnOrigin) { BackToAppButtonIsNotVisibleInBookmarkAppOnOrigin) {
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
const GURL& app_url = const GURL app_url =
embedded_test_server()->GetURL("app.com", "/ssl/google.html"); embedded_test_server()->GetURL("app.com", "/ssl/google.html");
const GURL& out_of_scope_url = GURL("https://example.com"); const GURL out_of_scope_url = GURL("https://example.com");
InstallBookmark(app_url); InstallBookmark(app_url);
EXPECT_TRUE(app_browser_->is_type_app()); EXPECT_TRUE(app_browser_->is_type_app());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment