Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: chrome/browser/extensions/admin_policy_unittest.cc

Issue 22794012: Rename extension_manifest_keys namespace to extensions::manifest_keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/extensions/admin_policy.h" 5 #include "chrome/browser/extensions/admin_policy.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "chrome/common/extensions/extension_manifest_constants.h"
10 #include "chrome/common/extensions/manifest.h" 9 #include "chrome/common/extensions/manifest.h"
10 #include "extensions/common/manifest_constants.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 using base::Value; 13 using base::Value;
14 using extensions::Extension; 14 using extensions::Extension;
15 using extensions::Manifest; 15 using extensions::Manifest;
16 16
17 namespace ap = extensions::admin_policy; 17 namespace ap = extensions::admin_policy;
18 18
19 class ExtensionAdminPolicyTest : public testing::Test { 19 class ExtensionAdminPolicyTest : public testing::Test {
20 public: 20 public:
21 void CreateExtension(Manifest::Location location) { 21 void CreateExtension(Manifest::Location location) {
22 base::DictionaryValue values; 22 base::DictionaryValue values;
23 CreateExtensionFromValues(location, &values); 23 CreateExtensionFromValues(location, &values);
24 } 24 }
25 25
26 void CreateHostedApp(Manifest::Location location) { 26 void CreateHostedApp(Manifest::Location location) {
27 base::DictionaryValue values; 27 base::DictionaryValue values;
28 values.Set(extension_manifest_keys::kWebURLs, new base::ListValue()); 28 values.Set(extensions::manifest_keys::kWebURLs, new base::ListValue());
29 values.SetString(extension_manifest_keys::kLaunchWebURL, 29 values.SetString(extensions::manifest_keys::kLaunchWebURL,
30 "http://www.example.com"); 30 "http://www.example.com");
31 CreateExtensionFromValues(location, &values); 31 CreateExtensionFromValues(location, &values);
32 } 32 }
33 33
34 void CreateExtensionFromValues(Manifest::Location location, 34 void CreateExtensionFromValues(Manifest::Location location,
35 base::DictionaryValue* values) { 35 base::DictionaryValue* values) {
36 values->SetString(extension_manifest_keys::kName, "test"); 36 values->SetString(extensions::manifest_keys::kName, "test");
37 values->SetString(extension_manifest_keys::kVersion, "0.1"); 37 values->SetString(extensions::manifest_keys::kVersion, "0.1");
38 std::string error; 38 std::string error;
39 extension_ = Extension::Create(base::FilePath(), location, *values, 39 extension_ = Extension::Create(base::FilePath(), location, *values,
40 Extension::NO_FLAGS, &error); 40 Extension::NO_FLAGS, &error);
41 ASSERT_TRUE(extension_.get()); 41 ASSERT_TRUE(extension_.get());
42 } 42 }
43 43
44 protected: 44 protected:
45 scoped_refptr<Extension> extension_; 45 scoped_refptr<Extension> extension_;
46 }; 46 };
47 47
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 string16 error; 187 string16 error;
188 EXPECT_TRUE(ap::MustRemainEnabled(extension_.get(), &error)); 188 EXPECT_TRUE(ap::MustRemainEnabled(extension_.get(), &error));
189 EXPECT_FALSE(error.empty()); 189 EXPECT_FALSE(error.empty());
190 190
191 CreateExtension(Manifest::INTERNAL); 191 CreateExtension(Manifest::INTERNAL);
192 error.clear(); 192 error.clear();
193 EXPECT_FALSE(ap::MustRemainEnabled(extension_.get(), NULL)); 193 EXPECT_FALSE(ap::MustRemainEnabled(extension_.get(), NULL));
194 EXPECT_FALSE(ap::MustRemainEnabled(extension_.get(), &error)); 194 EXPECT_FALSE(ap::MustRemainEnabled(extension_.get(), &error));
195 EXPECT_TRUE(error.empty()); 195 EXPECT_TRUE(error.empty());
196 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698