OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "chrome/common/extensions/extension.h" | 6 #include "chrome/common/extensions/extension.h" |
7 #include "chrome/common/extensions/extension_manifest_constants.h" | 7 #include "chrome/common/extensions/extension_manifest_constants.h" |
8 #include "chrome/common/extensions/manifest.h" | 8 #include "chrome/common/extensions/manifest.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 DictionaryValue* plugin = new DictionaryValue(); | 51 DictionaryValue* plugin = new DictionaryValue(); |
52 plugin->SetString(keys::kPluginsPath, std::string()); | 52 plugin->SetString(keys::kPluginsPath, std::string()); |
53 plugins->Set(i, plugin); | 53 plugins->Set(i, plugin); |
54 } | 54 } |
55 source.Set(keys::kPlugins, plugins); | 55 source.Set(keys::kPlugins, plugins); |
56 } | 56 } |
57 | 57 |
58 std::string error; | 58 std::string error; |
59 scoped_refptr<Extension> extension = Extension::Create( | 59 scoped_refptr<Extension> extension = Extension::Create( |
60 extension_path, location, source, creation_flags, &error); | 60 extension_path, location, source, creation_flags, &error); |
61 EXPECT_TRUE(extension); | 61 EXPECT_TRUE(extension.get()); |
62 EXPECT_EQ("", error); | 62 EXPECT_EQ("", error); |
63 return extension; | 63 return extension; |
64 } | 64 } |
65 | 65 |
66 static const char kValidUpdateUrl1[]; | 66 static const char kValidUpdateUrl1[]; |
67 static const char kValidUpdateUrl2[]; | 67 static const char kValidUpdateUrl2[]; |
68 }; | 68 }; |
69 | 69 |
70 const char ExtensionSyncTypeTest::kValidUpdateUrl1[] = | 70 const char ExtensionSyncTypeTest::kValidUpdateUrl1[] = |
71 "http://clients2.google.com/service/update2/crx"; | 71 "http://clients2.google.com/service/update2/crx"; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 | 219 |
220 // These last 2 tests don't make sense on Chrome OS, where extension plugins | 220 // These last 2 tests don't make sense on Chrome OS, where extension plugins |
221 // are not allowed. | 221 // are not allowed. |
222 #if !defined(OS_CHROMEOS) | 222 #if !defined(OS_CHROMEOS) |
223 TEST_F(ExtensionSyncTypeTest, ExtensionWithPlugin) { | 223 TEST_F(ExtensionSyncTypeTest, ExtensionWithPlugin) { |
224 scoped_refptr<Extension> extension( | 224 scoped_refptr<Extension> extension( |
225 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), | 225 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), |
226 Manifest::INTERNAL, 1, base::FilePath(), | 226 Manifest::INTERNAL, 1, base::FilePath(), |
227 Extension::NO_FLAGS)); | 227 Extension::NO_FLAGS)); |
228 if (extension) | 228 if (extension.get()) |
229 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); | 229 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); |
230 } | 230 } |
231 | 231 |
232 TEST_F(ExtensionSyncTypeTest, ExtensionWithTwoPlugins) { | 232 TEST_F(ExtensionSyncTypeTest, ExtensionWithTwoPlugins) { |
233 scoped_refptr<Extension> extension( | 233 scoped_refptr<Extension> extension( |
234 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), | 234 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), |
235 Manifest::INTERNAL, 2, base::FilePath(), | 235 Manifest::INTERNAL, 2, base::FilePath(), |
236 Extension::NO_FLAGS)); | 236 Extension::NO_FLAGS)); |
237 if (extension) | 237 if (extension.get()) |
238 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); | 238 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); |
239 } | 239 } |
240 #endif // !defined(OS_CHROMEOS) | 240 #endif // !defined(OS_CHROMEOS) |
241 | 241 |
242 } // namespace extensions | 242 } // namespace extensions |
OLD | NEW |