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

Side by Side Diff: chrome/browser/sync/js_sync_manager_observer_unittest.cc

Issue 6465005: [Sync] Initial support for encrypting any datatype (no UI hookup yet). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + small fix Created 9 years, 10 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) 2011 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/js_sync_manager_observer.h" 5 #include "chrome/browser/sync/js_sync_manager_observer.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 RouteJsEvent("onUpdatedToken", 142 RouteJsEvent("onUpdatedToken",
143 HasArgsAsList(redacted_args), NULL)); 143 HasArgsAsList(redacted_args), NULL));
144 EXPECT_CALL(mock_router_, 144 EXPECT_CALL(mock_router_,
145 RouteJsEvent("onPassphraseAccepted", 145 RouteJsEvent("onPassphraseAccepted",
146 HasArgsAsList(redacted_args), NULL)); 146 HasArgsAsList(redacted_args), NULL));
147 147
148 sync_manager_observer_.OnUpdatedToken("sensitive_token"); 148 sync_manager_observer_.OnUpdatedToken("sensitive_token");
149 sync_manager_observer_.OnPassphraseAccepted("sensitive_token"); 149 sync_manager_observer_.OnPassphraseAccepted("sensitive_token");
150 } 150 }
151 151
152 TEST_F(JsSyncManagerObserverTest, OnEncryptionComplete) {
153 ListValue expected_args;
154 ListValue* encrypted_type_values = new ListValue();
155 syncable::ModelTypeSet encrypted_types;
156
157 expected_args.Append(encrypted_type_values);
158 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
159 i < syncable::MODEL_TYPE_COUNT; ++i) {
160 syncable::ModelType type = syncable::ModelTypeFromInt(i);
161 encrypted_types.insert(type);
162 encrypted_type_values->Append(Value::CreateStringValue(
163 syncable::ModelTypeToString(type)));
164 }
165
166 EXPECT_CALL(mock_router_,
167 RouteJsEvent("onEncryptionComplete",
168 HasArgsAsList(expected_args), NULL));
169
170 sync_manager_observer_.OnEncryptionComplete(encrypted_types);
171 }
152 namespace { 172 namespace {
153 173
154 // Makes a node of the given model type. Returns the id of the 174 // Makes a node of the given model type. Returns the id of the
155 // newly-created node. 175 // newly-created node.
156 int64 MakeNode(sync_api::UserShare* share, syncable::ModelType model_type) { 176 int64 MakeNode(sync_api::UserShare* share, syncable::ModelType model_type) {
157 sync_api::WriteTransaction trans(share); 177 sync_api::WriteTransaction trans(share);
158 sync_api::ReadNode root_node(&trans); 178 sync_api::ReadNode root_node(&trans);
159 root_node.InitByRootLookup(); 179 root_node.InitByRootLookup();
160 sync_api::WriteNode node(&trans); 180 sync_api::WriteNode node(&trans);
161 EXPECT_TRUE(node.InitUniqueByCreation( 181 EXPECT_TRUE(node.InitUniqueByCreation(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 syncable::PASSWORDS - i); 252 syncable::PASSWORDS - i);
233 } 253 }
234 254
235 // |share.dir_manager| does not actually own its value. 255 // |share.dir_manager| does not actually own its value.
236 ignore_result(share.dir_manager.release()); 256 ignore_result(share.dir_manager.release());
237 setter_upper.TearDown(); 257 setter_upper.TearDown();
238 } 258 }
239 259
240 } // namespace 260 } // namespace
241 } // namespace browser_sync 261 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/js_sync_manager_observer.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698