| 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/signin_manager.h" | 5 #include "chrome/browser/signin/signin_manager.h" |
| 6 #include "chrome/browser/signin/signin_manager_factory.h" | 6 #include "chrome/browser/signin/signin_manager_factory.h" |
| 7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
| 8 #include "chrome/common/extensions/extension_builder.h" | 8 #include "chrome/common/extensions/extension_builder.h" |
| 9 #include "chrome/common/extensions/permissions/permissions_data.h" | 9 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
| 11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
| 12 #include "chrome/test/base/testing_profile_manager.h" | 12 #include "chrome/test/base/testing_profile_manager.h" |
| 13 #include "content/public/test/mock_render_process_host.h" | 13 #include "content/public/test/mock_render_process_host.h" |
| 14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class BrowserPermissionsPolicyDelegateTest : public testing::Test { | 21 class BrowserPermissionsPolicyDelegateTest : public testing::Test { |
| 22 public: | 22 public: |
| 23 BrowserPermissionsPolicyDelegateTest() | 23 BrowserPermissionsPolicyDelegateTest() |
| 24 : loop_(MessageLoop::TYPE_UI), | 24 : loop_(base::MessageLoop::TYPE_UI), |
| 25 ui_thread_(content::BrowserThread::UI, &loop_) { | 25 ui_thread_(content::BrowserThread::UI, &loop_) {} |
| 26 } | |
| 27 virtual void SetUp() { | 26 virtual void SetUp() { |
| 28 profile_manager_.reset( | 27 profile_manager_.reset( |
| 29 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 28 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 30 ASSERT_TRUE(profile_manager_->SetUp()); | 29 ASSERT_TRUE(profile_manager_->SetUp()); |
| 31 profile_ = profile_manager_->CreateTestingProfile("test"); | 30 profile_ = profile_manager_->CreateTestingProfile("test"); |
| 32 } | 31 } |
| 33 virtual void TearDown() { | 32 virtual void TearDown() { |
| 34 // Need to delete profile here before the UI thread is destroyed. | 33 // Need to delete profile here before the UI thread is destroyed. |
| 35 profile_manager_->DeleteTestingProfile("test"); | 34 profile_manager_->DeleteTestingProfile("test"); |
| 36 profile_manager_.reset(); | 35 profile_manager_.reset(); |
| 37 } | 36 } |
| 38 protected: | 37 protected: |
| 39 MessageLoop loop_; | 38 base::MessageLoop loop_; |
| 40 content::TestBrowserThread ui_thread_; | 39 content::TestBrowserThread ui_thread_; |
| 41 scoped_ptr<TestingProfileManager> profile_manager_; | 40 scoped_ptr<TestingProfileManager> profile_manager_; |
| 42 TestingProfile* profile_; | 41 TestingProfile* profile_; |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 scoped_refptr<const Extension> CreateTestExtension(const std::string& id) { | 44 scoped_refptr<const Extension> CreateTestExtension(const std::string& id) { |
| 46 return ExtensionBuilder() | 45 return ExtensionBuilder() |
| 47 .SetManifest(DictionaryBuilder() | 46 .SetManifest(DictionaryBuilder() |
| 48 .Set("name", "Extension with ID " + id) | 47 .Set("name", "Extension with ID " + id) |
| 49 .Set("version", "1.0") | 48 .Set("version", "1.0") |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 kSigninUrl, | 84 kSigninUrl, |
| 86 kSigninUrl, | 85 kSigninUrl, |
| 87 -1, | 86 -1, |
| 88 NULL, | 87 NULL, |
| 89 signin_process.GetID(), | 88 signin_process.GetID(), |
| 90 &error)) << error; | 89 &error)) << error; |
| 91 } | 90 } |
| 92 #endif | 91 #endif |
| 93 | 92 |
| 94 } // namespace extensions | 93 } // namespace extensions |
| OLD | NEW |