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

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

Issue 10920017: [Sync] Generalize StringOrdinal to handle ordinal_in_parent field (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Relax tests Created 8 years, 3 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
« no previous file with comments | « chrome/browser/extensions/app_sync_data.cc ('k') | chrome/browser/extensions/crx_installer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/protocol/app_specifics.pb.h" 8 #include "sync/protocol/app_specifics.pb.h"
8 #include "sync/protocol/sync.pb.h" 9 #include "sync/protocol/sync.pb.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace extensions { 12 namespace extensions {
12 13
13 namespace { 14 namespace {
14 15
15 const char kValidId[] = "abcdefghijklmnopabcdefghijklmnop"; 16 const char kValidId[] = "abcdefghijklmnopabcdefghijklmnop";
16 const char kName[] = "MyExtension"; 17 const char kName[] = "MyExtension";
(...skipping 17 matching lines...) Expand all
34 extension_specifics->set_enabled(false); 35 extension_specifics->set_enabled(false);
35 extension_specifics->set_incognito_enabled(true); 36 extension_specifics->set_incognito_enabled(true);
36 extension_specifics->set_name(kName); 37 extension_specifics->set_name(kName);
37 } 38 }
38 }; 39 };
39 40
40 TEST_F(AppSyncDataTest, SyncDataToExtensionSyncDataForApp) { 41 TEST_F(AppSyncDataTest, SyncDataToExtensionSyncDataForApp) {
41 sync_pb::EntitySpecifics entity; 42 sync_pb::EntitySpecifics entity;
42 sync_pb::AppSpecifics* app_specifics = entity.mutable_app(); 43 sync_pb::AppSpecifics* app_specifics = entity.mutable_app();
43 app_specifics->set_app_launch_ordinal( 44 app_specifics->set_app_launch_ordinal(
44 StringOrdinal::CreateInitialOrdinal().ToString()); 45 syncer::StringOrdinal::CreateInitialOrdinal().ToInternalValue());
45 app_specifics->set_page_ordinal( 46 app_specifics->set_page_ordinal(
46 StringOrdinal::CreateInitialOrdinal().ToString()); 47 syncer::StringOrdinal::CreateInitialOrdinal().ToInternalValue());
47 sync_pb::AppNotificationSettings* notif_settings = 48 sync_pb::AppNotificationSettings* notif_settings =
48 app_specifics->mutable_notification_settings(); 49 app_specifics->mutable_notification_settings();
49 notif_settings->set_oauth_client_id(kOAuthClientId); 50 notif_settings->set_oauth_client_id(kOAuthClientId);
50 notif_settings->set_disabled(true); 51 notif_settings->set_disabled(true);
51 52
52 SetRequiredExtensionValues(app_specifics->mutable_extension()); 53 SetRequiredExtensionValues(app_specifics->mutable_extension());
53 54
54 syncer::SyncData sync_data = 55 syncer::SyncData sync_data =
55 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity); 56 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity);
56 57
57 AppSyncData app_sync_data(sync_data); 58 AppSyncData app_sync_data(sync_data);
58 EXPECT_EQ(app_specifics->app_launch_ordinal(), 59 EXPECT_EQ(app_specifics->app_launch_ordinal(),
59 app_sync_data.app_launch_ordinal().ToString()); 60 app_sync_data.app_launch_ordinal().ToInternalValue());
60 EXPECT_EQ(app_specifics->page_ordinal(), 61 EXPECT_EQ(app_specifics->page_ordinal(),
61 app_sync_data.page_ordinal().ToString()); 62 app_sync_data.page_ordinal().ToInternalValue());
62 EXPECT_EQ(notif_settings->oauth_client_id(), 63 EXPECT_EQ(notif_settings->oauth_client_id(),
63 app_sync_data.notifications_client_id()); 64 app_sync_data.notifications_client_id());
64 EXPECT_EQ(notif_settings->disabled(), 65 EXPECT_EQ(notif_settings->disabled(),
65 app_sync_data.notifications_disabled()); 66 app_sync_data.notifications_disabled());
66 } 67 }
67 68
68 69
69 70
70 TEST_F(AppSyncDataTest, ExtensionSyncDataToSyncDataForApp) { 71 TEST_F(AppSyncDataTest, ExtensionSyncDataToSyncDataForApp) {
71 sync_pb::EntitySpecifics entity; 72 sync_pb::EntitySpecifics entity;
72 sync_pb::AppSpecifics* input_specifics = entity.mutable_app(); 73 sync_pb::AppSpecifics* input_specifics = entity.mutable_app();
73 input_specifics->set_app_launch_ordinal( 74 input_specifics->set_app_launch_ordinal(
74 StringOrdinal::CreateInitialOrdinal().ToString()); 75 syncer::StringOrdinal::CreateInitialOrdinal().ToInternalValue());
75 input_specifics->set_page_ordinal( 76 input_specifics->set_page_ordinal(
76 StringOrdinal::CreateInitialOrdinal().ToString()); 77 syncer::StringOrdinal::CreateInitialOrdinal().ToInternalValue());
77 sync_pb::AppNotificationSettings* notif_settings = 78 sync_pb::AppNotificationSettings* notif_settings =
78 input_specifics->mutable_notification_settings(); 79 input_specifics->mutable_notification_settings();
79 notif_settings->set_oauth_client_id(kOAuthClientId); 80 notif_settings->set_oauth_client_id(kOAuthClientId);
80 notif_settings->set_disabled(true); 81 notif_settings->set_disabled(true);
81 82
82 SetRequiredExtensionValues(input_specifics->mutable_extension()); 83 SetRequiredExtensionValues(input_specifics->mutable_extension());
83 84
84 syncer::SyncData sync_data = 85 syncer::SyncData sync_data =
85 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity); 86 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity);
86 AppSyncData app_sync_data(sync_data); 87 AppSyncData app_sync_data(sync_data);
(...skipping 23 matching lines...) Expand all
110 111
111 syncer::SyncData sync_data = 112 syncer::SyncData sync_data =
112 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity); 113 syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity);
113 114
114 // There should be no issue loading the sync data. 115 // There should be no issue loading the sync data.
115 AppSyncData app_sync_data(sync_data); 116 AppSyncData app_sync_data(sync_data);
116 app_sync_data.GetSyncData(); 117 app_sync_data.GetSyncData();
117 } 118 }
118 119
119 } // namespace extensions 120 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_sync_data.cc ('k') | chrome/browser/extensions/crx_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698