| 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 "chrome/browser/signin/chrome_signin_client.h" | 5 #include "chrome/browser/signin/chrome_signin_client.h" |
| 6 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 6 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 7 #include "chrome/browser/signin/signin_manager_factory.h" | 7 #include "chrome/browser/signin/signin_manager_factory.h" |
| 8 #include "chrome/test/base/testing_browser_process.h" | 8 #include "chrome/test/base/testing_browser_process.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "chrome/test/base/testing_profile_manager.h" | 10 #include "chrome/test/base/testing_profile_manager.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #if !defined(OS_CHROMEOS) | 57 #if !defined(OS_CHROMEOS) |
| 58 // Tests that CanExecuteScriptOnPage returns false for the signin process, | 58 // Tests that CanExecuteScriptOnPage returns false for the signin process, |
| 59 // all else being equal. | 59 // all else being equal. |
| 60 TEST_F(BrowserPermissionsPolicyDelegateTest, CanExecuteScriptOnPage) { | 60 TEST_F(BrowserPermissionsPolicyDelegateTest, CanExecuteScriptOnPage) { |
| 61 GURL kSigninUrl( | 61 GURL kSigninUrl( |
| 62 "https://accounts.google.com/ServiceLogin?service=chromiumsync"); | 62 "https://accounts.google.com/ServiceLogin?service=chromiumsync"); |
| 63 ASSERT_TRUE(SigninManager::IsWebBasedSigninFlowURL(kSigninUrl)); | 63 ASSERT_TRUE(SigninManager::IsWebBasedSigninFlowURL(kSigninUrl)); |
| 64 | 64 |
| 65 content::MockRenderProcessHost signin_process(profile_); | 65 content::MockRenderProcessHost signin_process(profile_); |
| 66 content::MockRenderProcessHost normal_process(profile_); | 66 content::MockRenderProcessHost normal_process(profile_); |
| 67 ChromeSigninClient* signin_client = | 67 SigninClient* signin_client = |
| 68 ChromeSigninClientFactory::GetForProfile(profile_); | 68 ChromeSigninClientFactory::GetForProfile(profile_); |
| 69 ASSERT_TRUE(signin_client); | 69 ASSERT_TRUE(signin_client); |
| 70 signin_client->SetSigninProcess(signin_process.GetID()); | 70 signin_client->SetSigninProcess(signin_process.GetID()); |
| 71 | 71 |
| 72 scoped_refptr<const Extension> extension(CreateTestExtension("a")); | 72 scoped_refptr<const Extension> extension(CreateTestExtension("a")); |
| 73 std::string error; | 73 std::string error; |
| 74 | 74 |
| 75 // The same call should succeed with a normal process, but fail with a signin | 75 // The same call should succeed with a normal process, but fail with a signin |
| 76 // process. | 76 // process. |
| 77 EXPECT_TRUE(PermissionsData::CanExecuteScriptOnPage(extension.get(), | 77 EXPECT_TRUE(PermissionsData::CanExecuteScriptOnPage(extension.get(), |
| 78 kSigninUrl, | 78 kSigninUrl, |
| 79 kSigninUrl, | 79 kSigninUrl, |
| 80 -1, | 80 -1, |
| 81 NULL, | 81 NULL, |
| 82 normal_process.GetID(), | 82 normal_process.GetID(), |
| 83 &error)) << error; | 83 &error)) << error; |
| 84 EXPECT_FALSE(PermissionsData::CanExecuteScriptOnPage(extension.get(), | 84 EXPECT_FALSE(PermissionsData::CanExecuteScriptOnPage(extension.get(), |
| 85 kSigninUrl, | 85 kSigninUrl, |
| 86 kSigninUrl, | 86 kSigninUrl, |
| 87 -1, | 87 -1, |
| 88 NULL, | 88 NULL, |
| 89 signin_process.GetID(), | 89 signin_process.GetID(), |
| 90 &error)) << error; | 90 &error)) << error; |
| 91 } | 91 } |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 } // namespace extensions | 94 } // namespace extensions |
| OLD | NEW |