| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // Redirect to app2. | 153 // Redirect to app2. |
| 154 GURL redirect_url(embedded_test_server()->GetURL( | 154 GURL redirect_url(embedded_test_server()->GetURL( |
| 155 "/extensions/isolated_apps/app2/redirect.html")); | 155 "/extensions/isolated_apps/app2/redirect.html")); |
| 156 ui_test_utils::NavigateToURL(browser(), redirect_url); | 156 ui_test_utils::NavigateToURL(browser(), redirect_url); |
| 157 | 157 |
| 158 // Go back twice. | 158 // Go back twice. |
| 159 // If bug fixed, we cannot go back anymore. | 159 // If bug fixed, we cannot go back anymore. |
| 160 // If not fixed, we will redirect back to app2 and can go back again. | 160 // If not fixed, we will redirect back to app2 and can go back again. |
| 161 EXPECT_TRUE(chrome::CanGoBack(browser())); | 161 EXPECT_TRUE(chrome::CanGoBack(browser())); |
| 162 chrome::GoBack(browser(), CURRENT_TAB); | 162 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 163 EXPECT_TRUE(chrome::CanGoBack(browser())); | 163 EXPECT_TRUE(chrome::CanGoBack(browser())); |
| 164 chrome::GoBack(browser(), CURRENT_TAB); | 164 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 165 EXPECT_FALSE(chrome::CanGoBack(browser())); | 165 EXPECT_FALSE(chrome::CanGoBack(browser())); |
| 166 | 166 |
| 167 // We also need to test script-initialized navigation (document.location.href) | 167 // We also need to test script-initialized navigation (document.location.href) |
| 168 // happened after page finishes loading. This one will also triggered the | 168 // happened after page finishes loading. This one will also triggered the |
| 169 // willPerformClientRedirect hook in RenderViewImpl but should not replace | 169 // willPerformClientRedirect hook in RenderViewImpl but should not replace |
| 170 // the previous history entry. | 170 // the previous history entry. |
| 171 ui_test_utils::NavigateToURLWithDisposition( | 171 ui_test_utils::NavigateToURLWithDisposition( |
| 172 browser(), base_url.Resolve("non_app/main.html"), | 172 browser(), base_url.Resolve("non_app/main.html"), |
| 173 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 173 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 174 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 174 | 175 |
| 175 WebContents* tab0 = browser()->tab_strip_model()->GetWebContentsAt(1); | 176 WebContents* tab0 = browser()->tab_strip_model()->GetWebContentsAt(1); |
| 176 | 177 |
| 177 // Using JavaScript to navigate to app2 page, | 178 // Using JavaScript to navigate to app2 page, |
| 178 // after the non_app page has finished loading. | 179 // after the non_app page has finished loading. |
| 179 content::WindowedNotificationObserver observer1( | 180 content::WindowedNotificationObserver observer1( |
| 180 content::NOTIFICATION_LOAD_STOP, | 181 content::NOTIFICATION_LOAD_STOP, |
| 181 content::Source<NavigationController>( | 182 content::Source<NavigationController>( |
| 182 &browser()->tab_strip_model()->GetActiveWebContents()-> | 183 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 183 GetController())); | 184 GetController())); |
| 184 std::string script = base::StringPrintf( | 185 std::string script = base::StringPrintf( |
| 185 "document.location.href=\"%s\";", | 186 "document.location.href=\"%s\";", |
| 186 base_url.Resolve("app2/main.html").spec().c_str()); | 187 base_url.Resolve("app2/main.html").spec().c_str()); |
| 187 EXPECT_TRUE(ExecuteScript(tab0, script)); | 188 EXPECT_TRUE(ExecuteScript(tab0, script)); |
| 188 observer1.Wait(); | 189 observer1.Wait(); |
| 189 | 190 |
| 190 // This kind of navigation should not replace previous navigation entry. | 191 // This kind of navigation should not replace previous navigation entry. |
| 191 EXPECT_TRUE(chrome::CanGoBack(browser())); | 192 EXPECT_TRUE(chrome::CanGoBack(browser())); |
| 192 chrome::GoBack(browser(), CURRENT_TAB); | 193 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 193 EXPECT_FALSE(chrome::CanGoBack(browser())); | 194 EXPECT_FALSE(chrome::CanGoBack(browser())); |
| 194 } | 195 } |
| 195 | 196 |
| 196 // Tests that cookies set within an isolated app are not visible to normal | 197 // Tests that cookies set within an isolated app are not visible to normal |
| 197 // pages or other apps. | 198 // pages or other apps. |
| 198 // | 199 // |
| 199 // TODO(ajwong): Also test what happens if an app spans multiple sites in its | 200 // TODO(ajwong): Also test what happens if an app spans multiple sites in its |
| 200 // extent. These origins should also be isolated, but still have origin-based | 201 // extent. These origins should also be isolated, but still have origin-based |
| 201 // separation as you would expect. | 202 // separation as you would expect. |
| 202 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { | 203 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { |
| 203 host_resolver()->AddRule("*", "127.0.0.1"); | 204 host_resolver()->AddRule("*", "127.0.0.1"); |
| 204 ASSERT_TRUE(embedded_test_server()->Start()); | 205 ASSERT_TRUE(embedded_test_server()->Start()); |
| 205 | 206 |
| 206 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); | 207 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); |
| 207 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2"))); | 208 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2"))); |
| 208 | 209 |
| 209 // The app under test acts on URLs whose host is "localhost", | 210 // The app under test acts on URLs whose host is "localhost", |
| 210 // so the URLs we navigate to must have host "localhost". | 211 // so the URLs we navigate to must have host "localhost". |
| 211 GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); | 212 GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); |
| 212 GURL::Replacements replace_host; | 213 GURL::Replacements replace_host; |
| 213 replace_host.SetHostStr("localhost"); | 214 replace_host.SetHostStr("localhost"); |
| 214 base_url = base_url.ReplaceComponents(replace_host); | 215 base_url = base_url.ReplaceComponents(replace_host); |
| 215 | 216 |
| 216 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("app1/main.html")); | 217 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("app1/main.html")); |
| 217 ui_test_utils::NavigateToURLWithDisposition( | 218 ui_test_utils::NavigateToURLWithDisposition( |
| 218 browser(), base_url.Resolve("app2/main.html"), | 219 browser(), base_url.Resolve("app2/main.html"), |
| 219 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 220 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 221 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 220 ui_test_utils::NavigateToURLWithDisposition( | 222 ui_test_utils::NavigateToURLWithDisposition( |
| 221 browser(), base_url.Resolve("non_app/main.html"), | 223 browser(), base_url.Resolve("non_app/main.html"), |
| 222 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 224 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 225 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 223 | 226 |
| 224 ASSERT_EQ(3, browser()->tab_strip_model()->count()); | 227 ASSERT_EQ(3, browser()->tab_strip_model()->count()); |
| 225 | 228 |
| 226 // Ensure first two tabs have installed apps. | 229 // Ensure first two tabs have installed apps. |
| 227 WebContents* tab0 = browser()->tab_strip_model()->GetWebContentsAt(0); | 230 WebContents* tab0 = browser()->tab_strip_model()->GetWebContentsAt(0); |
| 228 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(1); | 231 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(1); |
| 229 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(2); | 232 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(2); |
| 230 ASSERT_TRUE(GetInstalledApp(tab0)); | 233 ASSERT_TRUE(GetInstalledApp(tab0)); |
| 231 ASSERT_TRUE(GetInstalledApp(tab1)); | 234 ASSERT_TRUE(GetInstalledApp(tab1)); |
| 232 ASSERT_TRUE(!GetInstalledApp(tab2)); | 235 ASSERT_TRUE(!GetInstalledApp(tab2)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 EXPECT_FALSE(HasCookie(tab2, "nonAppFrame")); | 281 EXPECT_FALSE(HasCookie(tab2, "nonAppFrame")); |
| 279 | 282 |
| 280 // Check that isolation persists even if the tab crashes and is reloaded. | 283 // Check that isolation persists even if the tab crashes and is reloaded. |
| 281 chrome::SelectNumberedTab(browser(), 0); | 284 chrome::SelectNumberedTab(browser(), 0); |
| 282 content::CrashTab(tab0); | 285 content::CrashTab(tab0); |
| 283 content::WindowedNotificationObserver observer( | 286 content::WindowedNotificationObserver observer( |
| 284 content::NOTIFICATION_LOAD_STOP, | 287 content::NOTIFICATION_LOAD_STOP, |
| 285 content::Source<NavigationController>( | 288 content::Source<NavigationController>( |
| 286 &browser()->tab_strip_model()->GetActiveWebContents()-> | 289 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 287 GetController())); | 290 GetController())); |
| 288 chrome::Reload(browser(), CURRENT_TAB); | 291 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 289 observer.Wait(); | 292 observer.Wait(); |
| 290 EXPECT_TRUE(HasCookie(tab0, "app1=3")); | 293 EXPECT_TRUE(HasCookie(tab0, "app1=3")); |
| 291 EXPECT_FALSE(HasCookie(tab0, "app2")); | 294 EXPECT_FALSE(HasCookie(tab0, "app2")); |
| 292 EXPECT_FALSE(HasCookie(tab0, "normalPage")); | 295 EXPECT_FALSE(HasCookie(tab0, "normalPage")); |
| 293 } | 296 } |
| 294 | 297 |
| 295 // This test is disabled due to being flaky. http://crbug.com/145588 | 298 // This test is disabled due to being flaky. http://crbug.com/145588 |
| 296 // Ensure that cookies are not isolated if the isolated apps are not installed. | 299 // Ensure that cookies are not isolated if the isolated apps are not installed. |
| 297 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) { | 300 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) { |
| 298 host_resolver()->AddRule("*", "127.0.0.1"); | 301 host_resolver()->AddRule("*", "127.0.0.1"); |
| 299 ASSERT_TRUE(embedded_test_server()->Start()); | 302 ASSERT_TRUE(embedded_test_server()->Start()); |
| 300 | 303 |
| 301 // The app under test acts on URLs whose host is "localhost", | 304 // The app under test acts on URLs whose host is "localhost", |
| 302 // so the URLs we navigate to must have host "localhost". | 305 // so the URLs we navigate to must have host "localhost". |
| 303 GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); | 306 GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); |
| 304 GURL::Replacements replace_host; | 307 GURL::Replacements replace_host; |
| 305 replace_host.SetHostStr("localhost"); | 308 replace_host.SetHostStr("localhost"); |
| 306 base_url = base_url.ReplaceComponents(replace_host); | 309 base_url = base_url.ReplaceComponents(replace_host); |
| 307 | 310 |
| 308 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("app1/main.html")); | 311 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("app1/main.html")); |
| 309 ui_test_utils::NavigateToURLWithDisposition( | 312 ui_test_utils::NavigateToURLWithDisposition( |
| 310 browser(), base_url.Resolve("app2/main.html"), | 313 browser(), base_url.Resolve("app2/main.html"), |
| 311 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 314 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 315 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 312 ui_test_utils::NavigateToURLWithDisposition( | 316 ui_test_utils::NavigateToURLWithDisposition( |
| 313 browser(), base_url.Resolve("non_app/main.html"), | 317 browser(), base_url.Resolve("non_app/main.html"), |
| 314 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 318 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 319 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 315 | 320 |
| 316 ASSERT_EQ(3, browser()->tab_strip_model()->count()); | 321 ASSERT_EQ(3, browser()->tab_strip_model()->count()); |
| 317 | 322 |
| 318 // Check that tabs see each other's cookies. | 323 // Check that tabs see each other's cookies. |
| 319 EXPECT_TRUE(HasCookie(browser()->tab_strip_model()->GetWebContentsAt(0), | 324 EXPECT_TRUE(HasCookie(browser()->tab_strip_model()->GetWebContentsAt(0), |
| 320 "app2=4")); | 325 "app2=4")); |
| 321 EXPECT_TRUE(HasCookie(browser()->tab_strip_model()->GetWebContentsAt(0), | 326 EXPECT_TRUE(HasCookie(browser()->tab_strip_model()->GetWebContentsAt(0), |
| 322 "normalPage=5")); | 327 "normalPage=5")); |
| 323 EXPECT_TRUE(HasCookie(browser()->tab_strip_model()->GetWebContentsAt(0), | 328 EXPECT_TRUE(HasCookie(browser()->tab_strip_model()->GetWebContentsAt(0), |
| 324 "nonAppFrame=6")); | 329 "nonAppFrame=6")); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 root_url = root_url.ReplaceComponents(replace_host); | 393 root_url = root_url.ReplaceComponents(replace_host); |
| 389 base_url = base_url.ReplaceComponents(replace_host); | 394 base_url = base_url.ReplaceComponents(replace_host); |
| 390 | 395 |
| 391 // First set cookies inside and outside the app. | 396 // First set cookies inside and outside the app. |
| 392 ui_test_utils::NavigateToURL( | 397 ui_test_utils::NavigateToURL( |
| 393 browser(), root_url.Resolve("expect-and-set-cookie?set=nonApp%3d1")); | 398 browser(), root_url.Resolve("expect-and-set-cookie?set=nonApp%3d1")); |
| 394 WebContents* tab0 = browser()->tab_strip_model()->GetWebContentsAt(0); | 399 WebContents* tab0 = browser()->tab_strip_model()->GetWebContentsAt(0); |
| 395 ASSERT_FALSE(GetInstalledApp(tab0)); | 400 ASSERT_FALSE(GetInstalledApp(tab0)); |
| 396 ui_test_utils::NavigateToURLWithDisposition( | 401 ui_test_utils::NavigateToURLWithDisposition( |
| 397 browser(), base_url.Resolve("app1/main.html"), | 402 browser(), base_url.Resolve("app1/main.html"), |
| 398 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 403 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 404 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 399 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(1); | 405 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(1); |
| 400 ASSERT_TRUE(GetInstalledApp(tab1)); | 406 ASSERT_TRUE(GetInstalledApp(tab1)); |
| 401 | 407 |
| 402 // Check that each tab sees its own cookie. | 408 // Check that each tab sees its own cookie. |
| 403 EXPECT_TRUE(HasCookie(tab0, "nonApp=1")); | 409 EXPECT_TRUE(HasCookie(tab0, "nonApp=1")); |
| 404 EXPECT_FALSE(HasCookie(tab0, "app1=3")); | 410 EXPECT_FALSE(HasCookie(tab0, "app1=3")); |
| 405 EXPECT_FALSE(HasCookie(tab1, "nonApp=1")); | 411 EXPECT_FALSE(HasCookie(tab1, "nonApp=1")); |
| 406 EXPECT_TRUE(HasCookie(tab1, "app1=3")); | 412 EXPECT_TRUE(HasCookie(tab1, "app1=3")); |
| 407 | 413 |
| 408 // Now visit an app page that loads subresources located outside the app. | 414 // Now visit an app page that loads subresources located outside the app. |
| 409 // For both images and video tags, it loads two URLs: | 415 // For both images and video tags, it loads two URLs: |
| 410 // - One will set nonApp{Media,Image}=1 cookies if nonApp=1 is set. | 416 // - One will set nonApp{Media,Image}=1 cookies if nonApp=1 is set. |
| 411 // - One will set app1{Media,Image}=1 cookies if app1=3 is set. | 417 // - One will set app1{Media,Image}=1 cookies if app1=3 is set. |
| 412 // We expect only the app's cookies to be present. | 418 // We expect only the app's cookies to be present. |
| 413 // We must wait for the onload event, to allow the subresources to finish. | 419 // We must wait for the onload event, to allow the subresources to finish. |
| 414 content::WindowedNotificationObserver observer( | 420 content::WindowedNotificationObserver observer( |
| 415 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 421 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 416 content::Source<WebContents>( | 422 content::Source<WebContents>( |
| 417 browser()->tab_strip_model()->GetActiveWebContents())); | 423 browser()->tab_strip_model()->GetActiveWebContents())); |
| 418 ui_test_utils::NavigateToURL( | 424 ui_test_utils::NavigateToURL( |
| 419 browser(), base_url.Resolve("app1/app_subresources.html")); | 425 browser(), base_url.Resolve("app1/app_subresources.html")); |
| 420 observer.Wait(); | 426 observer.Wait(); |
| 421 EXPECT_FALSE(HasCookie(tab1, "nonAppMedia=1")); | 427 EXPECT_FALSE(HasCookie(tab1, "nonAppMedia=1")); |
| 422 EXPECT_TRUE(HasCookie(tab1, "app1Media=1")); | 428 EXPECT_TRUE(HasCookie(tab1, "app1Media=1")); |
| 423 EXPECT_FALSE(HasCookie(tab1, "nonAppImage=1")); | 429 EXPECT_FALSE(HasCookie(tab1, "nonAppImage=1")); |
| 424 EXPECT_TRUE(HasCookie(tab1, "app1Image=1")); | 430 EXPECT_TRUE(HasCookie(tab1, "app1Image=1")); |
| 425 | 431 |
| 426 // Also create a non-app tab to ensure no new cookies were set in that jar. | 432 // Also create a non-app tab to ensure no new cookies were set in that jar. |
| 427 ui_test_utils::NavigateToURLWithDisposition( | 433 ui_test_utils::NavigateToURLWithDisposition( |
| 428 browser(), root_url, | 434 browser(), root_url, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 429 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 435 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 430 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(2); | 436 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(2); |
| 431 EXPECT_FALSE(HasCookie(tab2, "nonAppMedia=1")); | 437 EXPECT_FALSE(HasCookie(tab2, "nonAppMedia=1")); |
| 432 EXPECT_FALSE(HasCookie(tab2, "app1Media=1")); | 438 EXPECT_FALSE(HasCookie(tab2, "app1Media=1")); |
| 433 EXPECT_FALSE(HasCookie(tab2, "nonAppImage=1")); | 439 EXPECT_FALSE(HasCookie(tab2, "nonAppImage=1")); |
| 434 EXPECT_FALSE(HasCookie(tab2, "app1Image=1")); | 440 EXPECT_FALSE(HasCookie(tab2, "app1Image=1")); |
| 435 } | 441 } |
| 436 | 442 |
| 437 // Test is flaky on Windows. | 443 // Test is flaky on Windows. |
| 438 // http://crbug.com/247667 | 444 // http://crbug.com/247667 |
| 439 #if defined(OS_WIN) | 445 #if defined(OS_WIN) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 455 // so the URLs we navigate to must have host "localhost". | 461 // so the URLs we navigate to must have host "localhost". |
| 456 GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); | 462 GURL base_url = embedded_test_server()->GetURL("/extensions/isolated_apps/"); |
| 457 GURL::Replacements replace_host; | 463 GURL::Replacements replace_host; |
| 458 replace_host.SetHostStr("localhost"); | 464 replace_host.SetHostStr("localhost"); |
| 459 base_url = base_url.ReplaceComponents(replace_host); | 465 base_url = base_url.ReplaceComponents(replace_host); |
| 460 | 466 |
| 461 // Create three tabs in the isolated app in different ways. | 467 // Create three tabs in the isolated app in different ways. |
| 462 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("app1/main.html")); | 468 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("app1/main.html")); |
| 463 ui_test_utils::NavigateToURLWithDisposition( | 469 ui_test_utils::NavigateToURLWithDisposition( |
| 464 browser(), base_url.Resolve("app1/main.html"), | 470 browser(), base_url.Resolve("app1/main.html"), |
| 465 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 471 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 472 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 466 // For the third tab, use window.open to keep it in process with an opener. | 473 // For the third tab, use window.open to keep it in process with an opener. |
| 467 OpenWindow(browser()->tab_strip_model()->GetWebContentsAt(0), | 474 OpenWindow(browser()->tab_strip_model()->GetWebContentsAt(0), |
| 468 base_url.Resolve("app1/main.html"), true, NULL); | 475 base_url.Resolve("app1/main.html"), true, NULL); |
| 469 | 476 |
| 470 // In a fourth tab, use window.open to a non-app URL. It should open in a | 477 // In a fourth tab, use window.open to a non-app URL. It should open in a |
| 471 // separate process, even though this would trigger the OAuth workaround | 478 // separate process, even though this would trigger the OAuth workaround |
| 472 // for hosted apps (from http://crbug.com/59285). | 479 // for hosted apps (from http://crbug.com/59285). |
| 473 OpenWindow(browser()->tab_strip_model()->GetWebContentsAt(0), | 480 OpenWindow(browser()->tab_strip_model()->GetWebContentsAt(0), |
| 474 base_url.Resolve("non_app/main.html"), false, NULL); | 481 base_url.Resolve("non_app/main.html"), false, NULL); |
| 475 | 482 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 browser(), base_url.Resolve("non_app/main.html")); | 563 browser(), base_url.Resolve("non_app/main.html")); |
| 557 ASSERT_TRUE(ExecuteScriptAndExtractString( | 564 ASSERT_TRUE(ExecuteScriptAndExtractString( |
| 558 browser()->tab_strip_model()->GetWebContentsAt(0), | 565 browser()->tab_strip_model()->GetWebContentsAt(0), |
| 559 kRetrieveSessionStorage.c_str(), &result)); | 566 kRetrieveSessionStorage.c_str(), &result)); |
| 560 EXPECT_EQ("ss_normal", result); | 567 EXPECT_EQ("ss_normal", result); |
| 561 } | 568 } |
| 562 | 569 |
| 563 } // namespace | 570 } // namespace |
| 564 | 571 |
| 565 } // namespace extensions | 572 } // namespace extensions |
| OLD | NEW |