OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 10 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
103 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); | 103 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); |
104 #elif defined(OS_POSIX) | 104 #elif defined(OS_POSIX) |
105 base::FilePath path(FILE_PATH_LITERAL("/foo")); | 105 base::FilePath path(FILE_PATH_LITERAL("/foo")); |
106 #endif | 106 #endif |
107 base::DictionaryValue manifest; | 107 base::DictionaryValue manifest; |
108 manifest.SetString(keys::kName, "Protected"); | 108 manifest.SetString(keys::kName, "Protected"); |
109 manifest.SetString(keys::kVersion, "1"); | 109 manifest.SetString(keys::kVersion, "1"); |
110 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start"); | 110 manifest.SetString(keys::kLaunchWebURL, "http://explicit/protected/start"); |
111 base::ListValue* list = new base::ListValue(); | 111 base::ListValue* list = new base::ListValue(); |
112 list->Append(new base::StringValue("http://explicit/protected")); | 112 list->AppendString("http://explicit/protected"); |
113 list->Append(new base::StringValue("*://*.wildcards/protected")); | 113 list->AppendString("*://*.wildcards/protected"); |
114 manifest.Set(keys::kWebURLs, list); | 114 manifest.Set(keys::kWebURLs, list); |
115 std::string error; | 115 std::string error; |
116 scoped_refptr<Extension> protected_app = Extension::Create( | 116 scoped_refptr<Extension> protected_app = Extension::Create( |
117 path, Manifest::INVALID_LOCATION, manifest, | 117 path, Manifest::INVALID_LOCATION, manifest, |
118 Extension::NO_FLAGS, &error); | 118 Extension::NO_FLAGS, &error); |
119 EXPECT_TRUE(protected_app.get()) << error; | 119 EXPECT_TRUE(protected_app.get()) << error; |
120 return protected_app; | 120 return protected_app; |
121 } | 121 } |
122 | 122 |
123 scoped_refptr<Extension> CreateUnlimitedApp() { | 123 scoped_refptr<Extension> CreateUnlimitedApp() { |
124 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
125 base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); | 125 base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); |
126 #elif defined(OS_POSIX) | 126 #elif defined(OS_POSIX) |
127 base::FilePath path(FILE_PATH_LITERAL("/bar")); | 127 base::FilePath path(FILE_PATH_LITERAL("/bar")); |
128 #endif | 128 #endif |
129 base::DictionaryValue manifest; | 129 base::DictionaryValue manifest; |
130 manifest.SetString(keys::kName, "Unlimited"); | 130 manifest.SetString(keys::kName, "Unlimited"); |
131 manifest.SetString(keys::kVersion, "1"); | 131 manifest.SetString(keys::kVersion, "1"); |
132 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start"); | 132 manifest.SetString(keys::kLaunchWebURL, "http://explicit/unlimited/start"); |
133 base::ListValue* list = new base::ListValue(); | 133 base::ListValue* list = new base::ListValue(); |
134 list->Append(new base::StringValue("unlimitedStorage")); | 134 list->AppendString("unlimitedStorage"); |
135 manifest.Set(keys::kPermissions, list); | 135 manifest.Set(keys::kPermissions, list); |
136 list = new base::ListValue(); | 136 list = new base::ListValue(); |
137 list->Append(new base::StringValue("http://explicit/unlimited")); | 137 list->AppendString("http://explicit/unlimited"); |
138 list->Append(new base::StringValue("*://*.wildcards/unlimited")); | 138 list->AppendString("*://*.wildcards/unlimited"); |
139 manifest.Set(keys::kWebURLs, list); | 139 manifest.Set(keys::kWebURLs, list); |
140 std::string error; | 140 std::string error; |
141 scoped_refptr<Extension> unlimited_app = Extension::Create( | 141 scoped_refptr<Extension> unlimited_app = Extension::Create( |
142 path, Manifest::INVALID_LOCATION, manifest, | 142 path, Manifest::INVALID_LOCATION, manifest, |
143 Extension::NO_FLAGS, &error); | 143 Extension::NO_FLAGS, &error); |
144 EXPECT_TRUE(unlimited_app.get()) << error; | 144 EXPECT_TRUE(unlimited_app.get()) << error; |
145 return unlimited_app; | 145 return unlimited_app; |
146 } | 146 } |
147 | 147 |
148 scoped_refptr<Extension> CreateRegularApp() { | 148 scoped_refptr<Extension> CreateRegularApp() { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 EXPECT_TRUE(observer.IsCompleted()); | 407 EXPECT_TRUE(observer.IsCompleted()); |
408 } | 408 } |
409 | 409 |
410 observer.ExpectClear(); | 410 observer.ExpectClear(); |
411 policy_->RevokeRightsForAllExtensions(); | 411 policy_->RevokeRightsForAllExtensions(); |
412 base::MessageLoop::current()->RunUntilIdle(); | 412 base::MessageLoop::current()->RunUntilIdle(); |
413 EXPECT_TRUE(observer.IsCompleted()); | 413 EXPECT_TRUE(observer.IsCompleted()); |
414 | 414 |
415 policy_->RemoveObserver(&observer); | 415 policy_->RemoveObserver(&observer); |
416 } | 416 } |
OLD | NEW |