| 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 "chrome/browser/extensions/extension_sync_data.h" | 5 #include "chrome/browser/extensions/extension_sync_data.h" | 
| 6 | 6 | 
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" | 
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" | 
| 9 #include "base/version.h" | 9 #include "base/version.h" | 
| 10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 63       ExtensionSyncData::CreateFromSyncData(sync_data); | 63       ExtensionSyncData::CreateFromSyncData(sync_data); | 
| 64   ASSERT_TRUE(output.get()); | 64   ASSERT_TRUE(output.get()); | 
| 65 | 65 | 
| 66   EXPECT_EQ(input.id(), output->id()); | 66   EXPECT_EQ(input.id(), output->id()); | 
| 67   EXPECT_EQ(input.uninstalled(), output->uninstalled()); | 67   EXPECT_EQ(input.uninstalled(), output->uninstalled()); | 
| 68   EXPECT_EQ(input.enabled(), output->enabled()); | 68   EXPECT_EQ(input.enabled(), output->enabled()); | 
| 69   EXPECT_EQ(input.incognito_enabled(), output->incognito_enabled()); | 69   EXPECT_EQ(input.incognito_enabled(), output->incognito_enabled()); | 
| 70   EXPECT_EQ(input.remote_install(), output->remote_install()); | 70   EXPECT_EQ(input.remote_install(), output->remote_install()); | 
| 71   EXPECT_EQ(input.installed_by_custodian(), output->installed_by_custodian()); | 71   EXPECT_EQ(input.installed_by_custodian(), output->installed_by_custodian()); | 
| 72   EXPECT_EQ(input.all_urls_enabled(), output->all_urls_enabled()); | 72   EXPECT_EQ(input.all_urls_enabled(), output->all_urls_enabled()); | 
| 73   EXPECT_TRUE(input.version().Equals(output->version())); | 73   EXPECT_EQ(input.version(), output->version()); | 
| 74   EXPECT_EQ(input.update_url(), output->update_url()); | 74   EXPECT_EQ(input.update_url(), output->update_url()); | 
| 75   EXPECT_EQ(input.name(), output->name()); | 75   EXPECT_EQ(input.name(), output->name()); | 
| 76 } | 76 } | 
| 77 | 77 | 
| 78 }  // namespace | 78 }  // namespace | 
| 79 | 79 | 
| 80 class ExtensionSyncDataTest : public testing::Test { | 80 class ExtensionSyncDataTest : public testing::Test { | 
| 81 }; | 81 }; | 
| 82 | 82 | 
| 83 // Tests the conversion process from a protobuf to an ExtensionSyncData and vice | 83 // Tests the conversion process from a protobuf to an ExtensionSyncData and vice | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 103   // the same result, but don't know that it's right). | 103   // the same result, but don't know that it's right). | 
| 104   ExtensionSyncData extension_sync_data; | 104   ExtensionSyncData extension_sync_data; | 
| 105   extension_sync_data.PopulateFromExtensionSpecifics(*extension_specifics); | 105   extension_sync_data.PopulateFromExtensionSpecifics(*extension_specifics); | 
| 106   EXPECT_EQ(kValidId, extension_sync_data.id()); | 106   EXPECT_EQ(kValidId, extension_sync_data.id()); | 
| 107   EXPECT_EQ(GURL(kValidUpdateUrl), extension_sync_data.update_url()); | 107   EXPECT_EQ(GURL(kValidUpdateUrl), extension_sync_data.update_url()); | 
| 108   EXPECT_FALSE(extension_sync_data.enabled()); | 108   EXPECT_FALSE(extension_sync_data.enabled()); | 
| 109   EXPECT_EQ(true, extension_sync_data.incognito_enabled()); | 109   EXPECT_EQ(true, extension_sync_data.incognito_enabled()); | 
| 110   EXPECT_FALSE(extension_sync_data.remote_install()); | 110   EXPECT_FALSE(extension_sync_data.remote_install()); | 
| 111   EXPECT_EQ(ExtensionSyncData::BOOLEAN_TRUE, | 111   EXPECT_EQ(ExtensionSyncData::BOOLEAN_TRUE, | 
| 112             extension_sync_data.all_urls_enabled()); | 112             extension_sync_data.all_urls_enabled()); | 
| 113   EXPECT_TRUE(Version(kVersion).Equals(extension_sync_data.version())); | 113   EXPECT_EQ(Version(kVersion), extension_sync_data.version()); | 
| 114   EXPECT_EQ(std::string(kName), extension_sync_data.name()); | 114   EXPECT_EQ(std::string(kName), extension_sync_data.name()); | 
| 115 | 115 | 
| 116   // Check the serialize-deserialize process for ExtensionSyncData to proto. | 116   // Check the serialize-deserialize process for ExtensionSyncData to proto. | 
| 117   SyncDataToProtobufEqual(extension_sync_data); | 117   SyncDataToProtobufEqual(extension_sync_data); | 
| 118 | 118 | 
| 119   // The most important thing to test is the "all urls" bit, since it is a | 119   // The most important thing to test is the "all urls" bit, since it is a | 
| 120   // tri-state boolean (and thus has more logic). Also flip another bit for a | 120   // tri-state boolean (and thus has more logic). Also flip another bit for a | 
| 121   // sanity check. | 121   // sanity check. | 
| 122   extension_specifics->set_all_urls_enabled(false); | 122   extension_specifics->set_all_urls_enabled(false); | 
| 123   extension_specifics->set_incognito_enabled(false); | 123   extension_specifics->set_incognito_enabled(false); | 
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 221       syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity); | 221       syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity); | 
| 222 | 222 | 
| 223   // There should be no issue loading the sync data. | 223   // There should be no issue loading the sync data. | 
| 224   scoped_ptr<ExtensionSyncData> app_sync_data = | 224   scoped_ptr<ExtensionSyncData> app_sync_data = | 
| 225       ExtensionSyncData::CreateFromSyncData(sync_data); | 225       ExtensionSyncData::CreateFromSyncData(sync_data); | 
| 226   ASSERT_TRUE(app_sync_data.get()); | 226   ASSERT_TRUE(app_sync_data.get()); | 
| 227   app_sync_data->GetSyncData(); | 227   app_sync_data->GetSyncData(); | 
| 228 } | 228 } | 
| 229 | 229 | 
| 230 }  // namespace extensions | 230 }  // namespace extensions | 
| OLD | NEW | 
|---|