| 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/app_sync_data.h" | 5 #include "chrome/browser/extensions/app_sync_data.h" |
| 6 | 6 |
| 7 #include "sync/api/string_ordinal.h" | 7 #include "sync/api/string_ordinal.h" |
| 8 #include "sync/protocol/app_specifics.pb.h" | 8 #include "sync/protocol/app_specifics.pb.h" |
| 9 #include "sync/protocol/sync.pb.h" | 9 #include "sync/protocol/sync.pb.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 | 13 |
| 14 const char kValidId[] = "abcdefghijklmnopabcdefghijklmnop"; | 14 const char kValidId[] = "abcdefghijklmnopabcdefghijklmnop"; |
| 15 const char kName[] = "MyExtension"; | 15 const char kName[] = "MyExtension"; |
| 16 const char kValidVersion[] = "0.0.0.0"; | 16 const char kValidVersion[] = "0.0.0.0"; |
| 17 const char kValidUpdateUrl[] = "http://clients2.google.com/service/update2/crx"; | 17 const char kValidUpdateUrl[] = "http://clients2.google.com/service/update2/crx"; |
| 18 | 18 |
| 19 class AppSyncDataTest : public testing::Test { | 19 class AppSyncDataTest : public testing::Test { |
| 20 public: | 20 public: |
| 21 AppSyncDataTest() {} | 21 AppSyncDataTest() {} |
| 22 ~AppSyncDataTest() override {} | 22 ~AppSyncDataTest() override {} |
| 23 | 23 |
| 24 void SetRequiredExtensionValues( | 24 void SetRequiredExtensionValues( |
| 25 sync_pb::ExtensionSpecifics* extension_specifics) { | 25 sync_pb::ExtensionSpecifics* extension_specifics) { |
| 26 extension_specifics->set_id(kValidId); | 26 extension_specifics->set_id(kValidId); |
| 27 extension_specifics->set_update_url(kValidUpdateUrl); | 27 extension_specifics->set_update_url(kValidUpdateUrl); |
| 28 extension_specifics->set_version(kValidVersion); | 28 extension_specifics->set_version(kValidVersion); |
| 29 extension_specifics->set_enabled(false); | 29 extension_specifics->set_enabled(false); |
| 30 extension_specifics->set_disable_reasons(0); |
| 30 extension_specifics->set_incognito_enabled(true); | 31 extension_specifics->set_incognito_enabled(true); |
| 31 extension_specifics->set_remote_install(false); | 32 extension_specifics->set_remote_install(false); |
| 32 extension_specifics->set_all_urls_enabled(true); | 33 extension_specifics->set_all_urls_enabled(true); |
| 33 extension_specifics->set_installed_by_custodian(false); | 34 extension_specifics->set_installed_by_custodian(false); |
| 34 extension_specifics->set_name(kName); | 35 extension_specifics->set_name(kName); |
| 35 } | 36 } |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 TEST_F(AppSyncDataTest, SyncDataToExtensionSyncDataForApp) { | 39 TEST_F(AppSyncDataTest, SyncDataToExtensionSyncDataForApp) { |
| 39 sync_pb::EntitySpecifics entity; | 40 sync_pb::EntitySpecifics entity; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity); | 98 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity); |
| 98 | 99 |
| 99 // There should be no issue loading the sync data. | 100 // There should be no issue loading the sync data. |
| 100 scoped_ptr<AppSyncData> app_sync_data = | 101 scoped_ptr<AppSyncData> app_sync_data = |
| 101 AppSyncData::CreateFromSyncData(sync_data); | 102 AppSyncData::CreateFromSyncData(sync_data); |
| 102 ASSERT_TRUE(app_sync_data.get()); | 103 ASSERT_TRUE(app_sync_data.get()); |
| 103 app_sync_data->GetSyncData(); | 104 app_sync_data->GetSyncData(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace extensions | 107 } // namespace extensions |
| OLD | NEW |