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_bundle.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 protected: |
23 BrowserPermissionsPolicyDelegateTest() | |
24 : loop_(base::MessageLoop::TYPE_UI), | |
25 ui_thread_(content::BrowserThread::UI, &loop_) {} | |
26 virtual void SetUp() { | 23 virtual void SetUp() { |
27 profile_manager_.reset( | 24 profile_manager_.reset( |
28 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 25 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
29 ASSERT_TRUE(profile_manager_->SetUp()); | 26 ASSERT_TRUE(profile_manager_->SetUp()); |
30 profile_ = profile_manager_->CreateTestingProfile("test"); | 27 profile_ = profile_manager_->CreateTestingProfile("test"); |
31 } | 28 } |
32 virtual void TearDown() { | 29 virtual void TearDown() { |
33 // Need to delete profile here before the UI thread is destroyed. | 30 // Need to delete profile here before the UI thread is destroyed. |
34 profile_manager_->DeleteTestingProfile("test"); | 31 profile_manager_->DeleteTestingProfile("test"); |
35 profile_manager_.reset(); | 32 profile_manager_.reset(); |
36 } | 33 } |
37 protected: | 34 protected: |
38 base::MessageLoop loop_; | 35 content::TestBrowserThreadBundle thread_bundle_; |
39 content::TestBrowserThread ui_thread_; | |
40 scoped_ptr<TestingProfileManager> profile_manager_; | 36 scoped_ptr<TestingProfileManager> profile_manager_; |
41 TestingProfile* profile_; | 37 TestingProfile* profile_; |
42 }; | 38 }; |
43 | 39 |
44 scoped_refptr<const Extension> CreateTestExtension(const std::string& id) { | 40 scoped_refptr<const Extension> CreateTestExtension(const std::string& id) { |
45 return ExtensionBuilder() | 41 return ExtensionBuilder() |
46 .SetManifest(DictionaryBuilder() | 42 .SetManifest(DictionaryBuilder() |
47 .Set("name", "Extension with ID " + id) | 43 .Set("name", "Extension with ID " + id) |
48 .Set("version", "1.0") | 44 .Set("version", "1.0") |
49 .Set("manifest_version", 2) | 45 .Set("manifest_version", 2) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 kSigninUrl, | 80 kSigninUrl, |
85 kSigninUrl, | 81 kSigninUrl, |
86 -1, | 82 -1, |
87 NULL, | 83 NULL, |
88 signin_process.GetID(), | 84 signin_process.GetID(), |
89 &error)) << error; | 85 &error)) << error; |
90 } | 86 } |
91 #endif | 87 #endif |
92 | 88 |
93 } // namespace extensions | 89 } // namespace extensions |
OLD | NEW |