| 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/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // Replace the signin manager and token service with fakes. Do this ahead of | 475 // Replace the signin manager and token service with fakes. Do this ahead of |
| 476 // creating the browser so that a bunch of classes don't register as | 476 // creating the browser so that a bunch of classes don't register as |
| 477 // observers and end up needing to unregister when the fake is substituted. | 477 // observers and end up needing to unregister when the fake is substituted. |
| 478 SigninManagerFactory::GetInstance()->SetTestingFactory( | 478 SigninManagerFactory::GetInstance()->SetTestingFactory( |
| 479 context, &BuildFakeSigninManagerBase); | 479 context, &BuildFakeSigninManagerBase); |
| 480 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( | 480 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( |
| 481 context, &BuildFakeProfileOAuth2TokenService); | 481 context, &BuildFakeProfileOAuth2TokenService); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void SetUpOnMainThread() override { | 484 void SetUpOnMainThread() override { |
| 485 InProcessBrowserTest::SetUpOnMainThread(); | |
| 486 | |
| 487 // Grab references to the fake signin manager and token service. | 485 // Grab references to the fake signin manager and token service. |
| 488 Profile* profile = browser()->profile(); | 486 Profile* profile = browser()->profile(); |
| 489 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( | 487 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( |
| 490 SigninManagerFactory::GetInstance()->GetForProfile(profile)); | 488 SigninManagerFactory::GetInstance()->GetForProfile(profile)); |
| 491 ASSERT_TRUE(signin_manager_); | 489 ASSERT_TRUE(signin_manager_); |
| 492 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( | 490 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( |
| 493 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile( | 491 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile( |
| 494 profile)); | 492 profile)); |
| 495 ASSERT_TRUE(token_service_); | 493 ASSERT_TRUE(token_service_); |
| 496 } | 494 } |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 content::WebContents* contents = | 934 content::WebContents* contents = |
| 937 browser()->tab_strip_model()->GetActiveWebContents(); | 935 browser()->tab_strip_model()->GetActiveWebContents(); |
| 938 ASSERT_TRUE(content::ExecuteScript( | 936 ASSERT_TRUE(content::ExecuteScript( |
| 939 contents, "window.location.href = 'chrome://foo'")); | 937 contents, "window.location.href = 'chrome://foo'")); |
| 940 | 938 |
| 941 content::TestNavigationObserver navigation_observer(contents, 1); | 939 content::TestNavigationObserver navigation_observer(contents, 1); |
| 942 navigation_observer.Wait(); | 940 navigation_observer.Wait(); |
| 943 | 941 |
| 944 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); | 942 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); |
| 945 } | 943 } |
| OLD | NEW |