summaryrefslogtreecommitdiffstats
path: root/components/sync_driver/non_blocking_data_type_controller_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* move V2 classes in chrome/engine to syncer_v2 namespacestanisc2015-08-141-8/+8
| | | | | | | | BUG=516512 Review URL: https://codereview.chromium.org/1285443002 Cr-Commit-Position: refs/heads/master@{#343452}
* Sync: move v2 classes in chrome/internal_api to syncer_v2 namespace.stanisc2015-08-051-8/+6
| | | | | | | | | | | | | | | | | This changes namespace of some of internal API Bismarck classes from syncer to syncer_v2 to make it easier to distinguish the new code from the current Sync implementation. The change includes a bit of dependency cleanup. This is a fairly trivial change, but a good way to see most of Bismarck classes and how they are integrated in the rest of the code. There are two more separate issues to make a similar namespace change in sync/engine and components/sync_driver directories. sync/engine BUG=516414 Review URL: https://codereview.chromium.org/1266113004 Cr-Commit-Position: refs/heads/master@{#341862}
* components: Remove use of MessageLoopProxy and deprecated MessageLoop APIsskyostil2015-06-021-1/+2
| | | | | | | | | | | This patch was mostly autogenerated with https://codereview.chromium.org/1010073002/. BUG=465354 Review URL: https://codereview.chromium.org/1144153004 Cr-Commit-Position: refs/heads/master@{#332440}
* Standardize usage of virtual/override/final specifiers.dcheng2014-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Google C++ style guide states: Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. To better conform to these guidelines, the following constructs have been rewritten: - if a base class has a virtual destructor, then: virtual ~Foo(); -> ~Foo() override; - virtual void Foo() override; -> void Foo() override; - virtual void Foo() override final; -> void Foo() final; This patch was automatically generated. The clang plugin can generate fixit hints, which are suggested edits when it is 100% sure it knows how to fix a problem. The hints from the clang plugin were applied to the source tree using the tool in https://codereview.chromium.org/598073004. BUG=417463 R=caitkp@chromium.org Review URL: https://codereview.chromium.org/684513002 Cr-Commit-Position: refs/heads/master@{#301931}
* Standardize usage of virtual/override/final in components/dcheng2014-10-211-7/+6
| | | | | | | | | BUG=417463 TBR=blundell@chromium.org Review URL: https://codereview.chromium.org/666133002 Cr-Commit-Position: refs/heads/master@{#300456}
* replace OVERRIDE and FINAL with override and final in components/mostynb2014-10-061-4/+4
| | | | | | | | BUG=417463 Review URL: https://codereview.chromium.org/623133002 Cr-Commit-Position: refs/heads/master@{#298237}
* sync: Add non-blocking type encryption (retry)rlarocque@chromium.org2014-08-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes some memory leak issues that were present in the first instance of this CL. Original description follows: Introduces the framework for dealing with sync encryption in non-blocking types. Unlike directory sync types, non-blocking type encryption only encrypts data before it is sent to the server. Encrypting the data on-disk is a separate problem. Adds code to the ModelTypeSyncWorker so it can access the directory's cryptographer (through a CryptographerProvider interface) and use it to encrypt entities before it sends them to the server. If the cryptographer is unable to encrypt with the desired key, the worker will not commit until the cryptographer returns to a good state. Adds the concept of a "desired encryption key" to the data type state. When the cryptographer key to be used to encrypt a type changes, this will be reflected in the data type state. The ModelTypeSyncProxy is responsible for ensuring that all items which have not yet been encrypted with this desired key are enqueued for commit. Makes the ModelTypeSyncWorker, EntityTracker, and ModelTypeSyncProxy collaborate on the management of undecryptable (inapplicable) updates. The EntityTracker keeps track of their version numbers and content, and prevents the committing of new items to the server until the inapplicable update has been dealt with. The ModelTypeSyncProxy is responsible for saving inapplicable updates across restarts. This CL alone is not enough to enable encryption support for non-blocking types. It requires additional code to hook up the ModelTypeSyncWorkers to receive cryptographer events. This will be added in a future commit. In the meantime, this CL includes plenty of unit tests to verify the functionality that's being added. BUG=351005 Review URL: https://codereview.chromium.org/442053002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287849 0039d316-1c4b-4281-b951-d872f2087c98
* Revert of sync: Add non-blocking type encryption support ↵thestig@chromium.org2014-08-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/423193002/) Reason for revert: Both LSAN and Valgrind complains about leaks in the tests. Original issue's description: > sync: Add non-blocking type encryption support > > Introduces the framework for dealing with sync encryption in > non-blocking types. Unlike directory sync types, non-blocking type > encryption only encrypts data before it is sent to the server. > Encrypting the data on-disk is a separate problem. > > Adds code to the ModelTypeSyncWorker so it can access the directory's > cryptographer (through a CryptographerProvider interface) and use it to > encrypt entities before it sends them to the server. If the > cryptographer is unable to encrypt with the desired key, the worker will > not commit until the cryptographer returns to a good state. > > Adds the concept of a "desired encryption key" to the data type state. > When the cryptographer key to be used to encrypt a type changes, this > will be reflected in the data type state. The ModelTypeSyncProxy is > responsible for ensuring that all items which have not yet been > encrypted with this desired key are enqueued for commit. > > Makes the ModelTypeSyncWorker, EntityTracker, and ModelTypeSyncProxy > collaborate on the management of undecryptable (inapplicable) updates. > The EntityTracker keeps track of their version numbers and content, and > prevents the committing of new items to the server until the > inapplicable update has been dealt with. The ModelTypeSyncProxy is > responsible for saving inapplicable updates across restarts. > > This CL alone is not enough to enable encryption support for > non-blocking types. It requires additional code to hook up the > ModelTypeSyncWorkers to receive cryptographer events. This will be > added in a future commit. In the meantime, this CL includes plenty > of unit tests to verify the functionality that's being added. > > BUG=351005 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=287428 TBR=zea@chromium.org,stanisc@chromium.org,rlarocque@chromium.org NOTREECHECKS=true NOTRY=true BUG=351005 Review URL: https://codereview.chromium.org/442623002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287433 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add non-blocking type encryption supportrlarocque@chromium.org2014-08-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the framework for dealing with sync encryption in non-blocking types. Unlike directory sync types, non-blocking type encryption only encrypts data before it is sent to the server. Encrypting the data on-disk is a separate problem. Adds code to the ModelTypeSyncWorker so it can access the directory's cryptographer (through a CryptographerProvider interface) and use it to encrypt entities before it sends them to the server. If the cryptographer is unable to encrypt with the desired key, the worker will not commit until the cryptographer returns to a good state. Adds the concept of a "desired encryption key" to the data type state. When the cryptographer key to be used to encrypt a type changes, this will be reflected in the data type state. The ModelTypeSyncProxy is responsible for ensuring that all items which have not yet been encrypted with this desired key are enqueued for commit. Makes the ModelTypeSyncWorker, EntityTracker, and ModelTypeSyncProxy collaborate on the management of undecryptable (inapplicable) updates. The EntityTracker keeps track of their version numbers and content, and prevents the committing of new items to the server until the inapplicable update has been dealt with. The ModelTypeSyncProxy is responsible for saving inapplicable updates across restarts. This CL alone is not enough to enable encryption support for non-blocking types. It requires additional code to hook up the ModelTypeSyncWorkers to receive cryptographer events. This will be added in a future commit. In the meantime, this CL includes plenty of unit tests to verify the functionality that's being added. BUG=351005 Review URL: https://codereview.chromium.org/423193002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287428 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Fix namespace for sync_driver componentzea@chromium.org2014-07-221-8/+9
| | | | | | | | | | | | browser_sync namespace was still in use while transitions were being made. We're far enough along now that it's worth moving to the sync_driver namespace. BUG=339728 TBR=bauerb@chromium.org Review URL: https://codereview.chromium.org/408003002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284799 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Inheritance refactor for non-blocking syncrlarocque@chromium.org2014-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | Implements several previously discussed changes to the inheritance hierarchy for non-blocking sync classes. Changes SyncContext from a wrapper around ModelTypeRegistry to an interface class that ModelTypeRegistry implemnts. Makes ModelTypeSyncWorkerImpl implement the ModelTypeSyncWorker interface, even though it is never referenced via this interface. Makes the same change to ModelTypeSyncProxyImpl and the ModelTypeSyncProxy interface. These refactoring required that some methods be renamed to be consistent with the interface. This completes the refactoring that was started in r279618. BUG=351005 Review URL: https://codereview.chromium.org/351073005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280417 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Mass rename of non-blocking sync classesrlarocque@chromium.org2014-06-251-142/+142
| | | | | | | | | | | | | | | | | | | | | | | | | Renames many of the classes involved in non-blocking sync: - Renames SyncCore, SyncCoreProxy to SyncContext and SyncContextProxy. - Renames NonBlockingTypeProcessor and NonBlockingTypeProcessorInterface to ModelTypeSyncProxyImpl and ModelTypeSyncProxy, respectively. - Renames NonBlockingTypeProcessorCore and NonBlockingTypeProcessorCoreInterface to ModelTypeSyncWorkerImpl and ModelTypeSyncWorker, respectively. - Renames ModelThreadSyncEntity to ModelTypeEntity. - Renames SyncThreadSyncEntity to EntityTracker. Renames any Mock, Test, Wrapper, or Impl classes associated with the above, too. This is only the first part of the planned refactoring. The second part, which involves some changes to the inheritance hierarchy, will be implemented in a future CL. BUG=351005 Review URL: https://codereview.chromium.org/351523003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279618 0039d316-1c4b-4281-b951-d872f2087c98
* Implement sync in the NonBlockingTypeProcessorrlarocque@chromium.org2014-05-221-5/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the NonBlockingTypeProcessor's sync logic. When combined with the NonBlockingTypeProcessorCore's sync logic (which will be introduced in a follow-up commit), this will be an alternative to the existing sync engine implemented with DirectoryUpdateHandler and DirectoryCommitContributor. Adds non_blocking_sync_common.h, which defines structs to be used to pass messages between the processor and processor core. Adds DataTypeState as a parameter to the processor to processor core connection methods. Eventually this will be used to initialize the processor core with state that the processor loaded from disk. Adds a lot of unit tests and unit test framework intrastructure. The NonBlockingTypeProcessor and NonBlockingTypeProcessorCore's communications with each other will be very racy. These tests are intended to help manage the complexity this will cause by allowing us to test all the possible race conditions individually. BUG=351005 Review URL: https://codereview.chromium.org/280983002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272329 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Move NonBlockingTypeProcessor to sync/enginerlarocque@chromium.org2014-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Moves NonBlockingTypeProcessor from sync/internal_api to sync/engine. It's become increasingly clear to me that the NonBlockingTypeProcessor will be too big to expose outside of sync. When it comes time to export its functionality, we'll need to define a wrapper class with a simpler interface. This means that there's no benefit to keeping it in internal_api. There is a benefit to moving this to sync/engine. In this location, it should be able to collaborate more closely with its sibling, the NonBlockingTypeProcessorCore. We intend to start adding lots of code to this class soon. It's a good idea to get this move out of the way first, so we can have a better git history in the end. BUG=351005 Review URL: https://codereview.chromium.org/280693003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270025 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Implement disabling of non blocking typesrlarocque@chromium.org2014-05-121-16/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds logic to have the model-thread NonBlockingDataTypeProcessor send a message to the sync-thread SyncCore when it receives notifcation from the ui-thread NonBlockingDataTypeController that it should stop syncing. This message will allow the sync thread to stop requeting updates and commits on behalf of the now-disabled type. Fixes the handling of a race in the NonBlockingDataTypeProcessor. The race is as follows: 1. NBDTP receives a request to enable sync from the UI thread, and sends a connection request to the sync thread via SyncCoreProxy. 2. NBDTP receives a request to disable sync from the UI thread. It updates its internal state accordingly. 3. NBDTP receives the connection OK response from the sync thread, which was genrated in response to its request in step 1. Previously, the processor would wrongly set itself to the enable state in step 3. The fix is to use a new WeakPtrFactory and invalidate the pointers it has issued in step 2 in order to prevent the response seen in step 3 from being run. Adds some more tests for this scenario and more. The test framework had to be made a bit more complicated in order to handle these tests, but I think the extra complexity is worth it. I don't know of any other way to reliably defend against these race cases. BUG=351005 Review URL: https://codereview.chromium.org/272323002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269916 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add NonBlockingDataTypeManagerrlarocque@chromium.org2014-05-011-1/+1
| | | | | | | | | | | | | | | | | | The new class manages the set of NonBlockingDataTypeControllers. Its logic could have fit into the ProfileSyncService, but the code is a bit cleaner if we factor it out into a separate class. This CL does actually instantiate and make use of the NonBlockingDataTypeManager, so it is not entirely a no-op. However, without any registered non-blocking types, there will be no NonBlockingDataTypeControllers for it to manage, so its functionality will be limited. BUG=351005 Review URL: https://codereview.chromium.org/251143003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267461 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce NonBlockingDataTypeControllerrlarocque@chromium.org2014-04-261-0/+227
The NonBlockingDataTypeController tracks the sync state of a non-blocking data type and sends signals to its components from the UI thread. It is responsible for enabling and disabling sync for a data type according to user preference and the availbility of the sync backend. This CL also includes some changes to the NonBlockingDataTypeProcessor, which is currently just a stub of what will eventually become non-blocking sync's model thread component, so that it can be used in testing NonBlockingDataTypeController. BUG=351005 Review URL: https://codereview.chromium.org/249843002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266344 0039d316-1c4b-4281-b951-d872f2087c98