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

Side by Side Diff: chrome/browser/sync/glue/extension_util_unittest.cc

Issue 6766002: Replace bools in extension creation with flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For landing Created 9 years, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/sync/glue/extension_util.h" 5 #include "chrome/browser/sync/glue/extension_util.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" 9 #include "chrome/browser/sync/protocol/extension_specifics.pb.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/extension_constants.h" 11 #include "chrome/common/extensions/extension_constants.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 for (int i = 0; i < num_plugins; ++i) { 64 for (int i = 0; i < num_plugins; ++i) {
65 DictionaryValue* plugin = new DictionaryValue(); 65 DictionaryValue* plugin = new DictionaryValue();
66 plugin->SetString(extension_manifest_keys::kPluginsPath, ""); 66 plugin->SetString(extension_manifest_keys::kPluginsPath, "");
67 plugins->Set(i, plugin); 67 plugins->Set(i, plugin);
68 } 68 }
69 source.Set(extension_manifest_keys::kPlugins, plugins); 69 source.Set(extension_manifest_keys::kPlugins, plugins);
70 } 70 }
71 71
72 std::string error; 72 std::string error;
73 scoped_refptr<Extension> extension = Extension::Create( 73 scoped_refptr<Extension> extension = Extension::Create(
74 extension_path, location, source, false, true, &error); 74 extension_path, location, source, Extension::STRICT_ERROR_CHECKS, &error);
75 #if defined(OS_CHROMEOS) 75 #if defined(OS_CHROMEOS)
76 if (num_plugins > 0) { // plugins are illegal in extensions on chrome os. 76 if (num_plugins > 0) { // plugins are illegal in extensions on chrome os.
77 EXPECT_FALSE(extension); 77 EXPECT_FALSE(extension);
78 return NULL; 78 return NULL;
79 } 79 }
80 #endif 80 #endif
81 EXPECT_TRUE(extension); 81 EXPECT_TRUE(extension);
82 EXPECT_EQ("", error); 82 EXPECT_EQ("", error);
83 return extension; 83 return extension;
84 } 84 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 const std::string& version_string, 379 const std::string& version_string,
380 const std::string& update_url_spec, 380 const std::string& update_url_spec,
381 const std::string& name, 381 const std::string& name,
382 const FilePath& extension_path) { 382 const FilePath& extension_path) {
383 DictionaryValue source; 383 DictionaryValue source;
384 source.SetString(extension_manifest_keys::kVersion, version_string); 384 source.SetString(extension_manifest_keys::kVersion, version_string);
385 source.SetString(extension_manifest_keys::kUpdateURL, update_url_spec); 385 source.SetString(extension_manifest_keys::kUpdateURL, update_url_spec);
386 source.SetString(extension_manifest_keys::kName, name); 386 source.SetString(extension_manifest_keys::kName, name);
387 std::string error; 387 std::string error;
388 scoped_refptr<Extension> extension = Extension::Create( 388 scoped_refptr<Extension> extension = Extension::Create(
389 extension_path, Extension::INTERNAL, source, false, true, &error); 389 extension_path, Extension::INTERNAL, source,
390 Extension::STRICT_ERROR_CHECKS, &error);
390 EXPECT_TRUE(extension); 391 EXPECT_TRUE(extension);
391 EXPECT_EQ("", error); 392 EXPECT_EQ("", error);
392 return extension; 393 return extension;
393 } 394 }
394 395
395 TEST_F(ExtensionUtilTest, GetExtensionSpecificsHelper) { 396 TEST_F(ExtensionUtilTest, GetExtensionSpecificsHelper) {
396 FilePath file_path(kExtensionFilePath); 397 FilePath file_path(kExtensionFilePath);
397 scoped_refptr<Extension> extension( 398 scoped_refptr<Extension> extension(
398 MakeSyncableExtension(kValidVersion, kValidUpdateUrl1, kName, file_path)); 399 MakeSyncableExtension(kValidVersion, kValidUpdateUrl1, kName, file_path));
399 sync_pb::ExtensionSpecifics specifics; 400 sync_pb::ExtensionSpecifics specifics;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 { 482 {
482 sync_pb::ExtensionSpecifics result = merged_specifics; 483 sync_pb::ExtensionSpecifics result = merged_specifics;
483 MergeExtensionSpecifics(specifics, true, &result); 484 MergeExtensionSpecifics(specifics, true, &result);
484 EXPECT_TRUE(AreExtensionSpecificsEqual(result, specifics)); 485 EXPECT_TRUE(AreExtensionSpecificsEqual(result, specifics));
485 } 486 }
486 } 487 }
487 488
488 } // namespace 489 } // namespace
489 490
490 } // namespace browser_sync 491 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_prefs.cc ('k') | chrome/browser/sync/glue/theme_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698