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/chromeos/extensions/external_cache.h" | 5 #include "chrome/browser/chromeos/extensions/external_cache.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 net::URLRequestContextGetter* request_context_getter() { | 50 net::URLRequestContextGetter* request_context_getter() { |
51 return request_context_getter_.get(); | 51 return request_context_getter_.get(); |
52 } | 52 } |
53 | 53 |
54 const base::DictionaryValue* provided_prefs() { | 54 const base::DictionaryValue* provided_prefs() { |
55 return prefs_.get(); | 55 return prefs_.get(); |
56 } | 56 } |
57 | 57 |
58 // testing::Test overrides: | 58 // testing::Test overrides: |
59 virtual void SetUp() OVERRIDE { | 59 virtual void SetUp() override { |
60 request_context_getter_ = new net::TestURLRequestContextGetter( | 60 request_context_getter_ = new net::TestURLRequestContextGetter( |
61 content::BrowserThread::GetMessageLoopProxyForThread( | 61 content::BrowserThread::GetMessageLoopProxyForThread( |
62 content::BrowserThread::IO)); | 62 content::BrowserThread::IO)); |
63 fetcher_factory_.reset(new net::TestURLFetcherFactory()); | 63 fetcher_factory_.reset(new net::TestURLFetcherFactory()); |
64 | 64 |
65 pool_owner_.reset( | 65 pool_owner_.reset( |
66 new base::SequencedWorkerPoolOwner(3, "Background Pool")); | 66 new base::SequencedWorkerPoolOwner(3, "Background Pool")); |
67 background_task_runner_ = pool_owner_->pool()->GetSequencedTaskRunner( | 67 background_task_runner_ = pool_owner_->pool()->GetSequencedTaskRunner( |
68 pool_owner_->pool()->GetNamedSequenceToken("background")); | 68 pool_owner_->pool()->GetNamedSequenceToken("background")); |
69 } | 69 } |
70 | 70 |
71 virtual void TearDown() OVERRIDE { | 71 virtual void TearDown() override { |
72 pool_owner_->pool()->Shutdown(); | 72 pool_owner_->pool()->Shutdown(); |
73 base::RunLoop().RunUntilIdle(); | 73 base::RunLoop().RunUntilIdle(); |
74 } | 74 } |
75 | 75 |
76 // ExternalCache::Delegate: | 76 // ExternalCache::Delegate: |
77 virtual void OnExtensionListsUpdated( | 77 virtual void OnExtensionListsUpdated( |
78 const base::DictionaryValue* prefs) OVERRIDE { | 78 const base::DictionaryValue* prefs) override { |
79 prefs_.reset(prefs->DeepCopy()); | 79 prefs_.reset(prefs->DeepCopy()); |
80 } | 80 } |
81 | 81 |
82 virtual std::string GetInstalledExtensionVersion( | 82 virtual std::string GetInstalledExtensionVersion( |
83 const std::string& id) OVERRIDE { | 83 const std::string& id) override { |
84 std::map<std::string, std::string>::iterator it = | 84 std::map<std::string, std::string>::iterator it = |
85 installed_extensions_.find(id); | 85 installed_extensions_.find(id); |
86 return it != installed_extensions_.end() ? it->second : std::string(); | 86 return it != installed_extensions_.end() ? it->second : std::string(); |
87 } | 87 } |
88 | 88 |
89 base::FilePath CreateCacheDir(bool initialized) { | 89 base::FilePath CreateCacheDir(bool initialized) { |
90 EXPECT_TRUE(cache_dir_.CreateUniqueTempDir()); | 90 EXPECT_TRUE(cache_dir_.CreateUniqueTempDir()); |
91 if (initialized) | 91 if (initialized) |
92 CreateFlagFile(cache_dir_.path()); | 92 CreateFlagFile(cache_dir_.path()); |
93 return cache_dir_.path(); | 93 return cache_dir_.path(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 ASSERT_TRUE(provided_prefs()->GetDictionary(kTestExtensionId1, &entry1)); | 307 ASSERT_TRUE(provided_prefs()->GetDictionary(kTestExtensionId1, &entry1)); |
308 EXPECT_TRUE(entry1->HasKey( | 308 EXPECT_TRUE(entry1->HasKey( |
309 extensions::ExternalProviderImpl::kExternalUpdateUrl)); | 309 extensions::ExternalProviderImpl::kExternalUpdateUrl)); |
310 EXPECT_FALSE(entry1->HasKey( | 310 EXPECT_FALSE(entry1->HasKey( |
311 extensions::ExternalProviderImpl::kExternalCrx)); | 311 extensions::ExternalProviderImpl::kExternalCrx)); |
312 EXPECT_FALSE(entry1->HasKey( | 312 EXPECT_FALSE(entry1->HasKey( |
313 extensions::ExternalProviderImpl::kExternalVersion)); | 313 extensions::ExternalProviderImpl::kExternalVersion)); |
314 } | 314 } |
315 | 315 |
316 } // namespace chromeos | 316 } // namespace chromeos |
OLD | NEW |