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

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

Issue 6537027: Revert 75287 - [Sync] Initial support for encrypting any datatype (no UI hook... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 }
172 namespace { 152 namespace {
173 153
174 // Makes a node of the given model type. Returns the id of the 154 // Makes a node of the given model type. Returns the id of the
175 // newly-created node. 155 // newly-created node.
176 int64 MakeNode(sync_api::UserShare* share, syncable::ModelType model_type) { 156 int64 MakeNode(sync_api::UserShare* share, syncable::ModelType model_type) {
177 sync_api::WriteTransaction trans(share); 157 sync_api::WriteTransaction trans(share);
178 sync_api::ReadNode root_node(&trans); 158 sync_api::ReadNode root_node(&trans);
179 root_node.InitByRootLookup(); 159 root_node.InitByRootLookup();
180 sync_api::WriteNode node(&trans); 160 sync_api::WriteNode node(&trans);
181 EXPECT_TRUE(node.InitUniqueByCreation( 161 EXPECT_TRUE(node.InitUniqueByCreation(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 syncable::PASSWORDS - i); 232 syncable::PASSWORDS - i);
253 } 233 }
254 234
255 // |share.dir_manager| does not actually own its value. 235 // |share.dir_manager| does not actually own its value.
256 ignore_result(share.dir_manager.release()); 236 ignore_result(share.dir_manager.release());
257 setter_upper.TearDown(); 237 setter_upper.TearDown();
258 } 238 }
259 239
260 } // namespace 240 } // namespace
261 } // namespace browser_sync 241 } // 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