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