| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/prefs/scoped_user_pref_update.h" | 7 #include "base/prefs/scoped_user_pref_update.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 9 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 local_state->SetString(prefs::kGoogleServicesUsernamePattern, pattern); | 295 local_state->SetString(prefs::kGoogleServicesUsernamePattern, pattern); |
| 296 } | 296 } |
| 297 | 297 |
| 298 #if defined(OS_LINUX) || defined(OS_WIN) | 298 #if defined(OS_LINUX) || defined(OS_WIN) |
| 299 // crbug.com/422868 | 299 // crbug.com/422868 |
| 300 #define MAYBE_DifferentStorageId DISABLED_DifferentStorageId | 300 #define MAYBE_DifferentStorageId DISABLED_DifferentStorageId |
| 301 #else | 301 #else |
| 302 #define MAYBE_DifferentStorageId DifferentStorageId | 302 #define MAYBE_DifferentStorageId DifferentStorageId |
| 303 #endif | 303 #endif |
| 304 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, MAYBE_DifferentStorageId) { | 304 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, MAYBE_DifferentStorageId) { |
| 305 if (switches::IsEnableWebviewBasedSignin()) { | 305 ContentInfo info = NavigateAndGetInfo( |
| 306 ContentInfo info = NavigateAndGetInfo( | 306 browser(), |
| 307 browser(), | 307 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), |
| 308 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 308 CURRENT_TAB); |
| 309 CURRENT_TAB); | 309 WaitUntilUIReady(browser()); |
| 310 WaitUntilUIReady(browser()); | |
| 311 | 310 |
| 312 // Make sure storage partition of embedded webview is different from | 311 // Make sure storage partition of embedded webview is different from |
| 313 // parent. | 312 // parent. |
| 314 std::set<content::WebContents*> set; | 313 std::set<content::WebContents*> set; |
| 315 GuestViewManager* manager = GuestViewManager::FromBrowserContext( | 314 GuestViewManager* manager = GuestViewManager::FromBrowserContext( |
| 316 info.contents->GetBrowserContext()); | 315 info.contents->GetBrowserContext()); |
| 317 manager->ForEachGuest(info.contents, base::Bind(&AddToSet, &set)); | 316 manager->ForEachGuest(info.contents, base::Bind(&AddToSet, &set)); |
| 318 ASSERT_EQ(1u, set.size()); | 317 ASSERT_EQ(1u, set.size()); |
| 319 content::WebContents* webview_contents = *set.begin(); | 318 content::WebContents* webview_contents = *set.begin(); |
| 320 content::RenderProcessHost* process = | 319 content::RenderProcessHost* process = |
| 321 webview_contents->GetRenderProcessHost(); | 320 webview_contents->GetRenderProcessHost(); |
| 322 ASSERT_NE(info.pid, process->GetID()); | 321 ASSERT_NE(info.pid, process->GetID()); |
| 323 ASSERT_NE(info.storage_partition, process->GetStoragePartition()); | 322 ASSERT_NE(info.storage_partition, process->GetStoragePartition()); |
| 324 } else { | |
| 325 GURL test_url = ui_test_utils::GetTestUrl( | |
| 326 base::FilePath(base::FilePath::kCurrentDirectory), | |
| 327 base::FilePath(FILE_PATH_LITERAL("title1.html"))); | |
| 328 | |
| 329 ContentInfo info1 = | |
| 330 NavigateAndGetInfo(browser(), test_url, CURRENT_TAB); | |
| 331 ContentInfo info2 = NavigateAndGetInfo( | |
| 332 browser(), | |
| 333 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | |
| 334 CURRENT_TAB); | |
| 335 NavigateAndGetInfo(browser(), test_url, CURRENT_TAB); | |
| 336 ContentInfo info3 = NavigateAndGetInfo( | |
| 337 browser(), | |
| 338 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | |
| 339 NEW_FOREGROUND_TAB); | |
| 340 | |
| 341 // The info for signin should be the same. | |
| 342 ASSERT_EQ(info2.storage_partition, info3.storage_partition); | |
| 343 // The info for test_url and signin should be different. | |
| 344 ASSERT_NE(info1.storage_partition, info2.storage_partition); | |
| 345 } | |
| 346 } | 323 } |
| 347 | 324 |
| 348 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, OneProcessLimit) { | 325 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, OneProcessLimit) { |
| 349 GURL test_url_1 = ui_test_utils::GetTestUrl( | 326 GURL test_url_1 = ui_test_utils::GetTestUrl( |
| 350 base::FilePath(base::FilePath::kCurrentDirectory), | 327 base::FilePath(base::FilePath::kCurrentDirectory), |
| 351 base::FilePath(FILE_PATH_LITERAL("title1.html"))); | 328 base::FilePath(FILE_PATH_LITERAL("title1.html"))); |
| 352 GURL test_url_2 = ui_test_utils::GetTestUrl( | 329 GURL test_url_2 = ui_test_utils::GetTestUrl( |
| 353 base::FilePath(base::FilePath::kCurrentDirectory), | 330 base::FilePath(base::FilePath::kCurrentDirectory), |
| 354 base::FilePath(FILE_PATH_LITERAL("data:text/html,Hello world!"))); | 331 base::FilePath(FILE_PATH_LITERAL("data:text/html,Hello world!"))); |
| 355 | 332 |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 ->AddObserver(&observer); | 886 ->AddObserver(&observer); |
| 910 base::RunLoop run_loop; | 887 base::RunLoop run_loop; |
| 911 EXPECT_CALL(observer, OnUntrustedLoginUIShown()) | 888 EXPECT_CALL(observer, OnUntrustedLoginUIShown()) |
| 912 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 889 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 913 | 890 |
| 914 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password"); | 891 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password"); |
| 915 run_loop.Run(); | 892 run_loop.Run(); |
| 916 base::MessageLoop::current()->RunUntilIdle(); | 893 base::MessageLoop::current()->RunUntilIdle(); |
| 917 } | 894 } |
| 918 #endif // OS_CHROMEOS | 895 #endif // OS_CHROMEOS |
| OLD | NEW |