Chromium Code Reviews| 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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
| 6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
| 7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2552 } | 2552 } |
| 2553 | 2553 |
| 2554 private: | 2554 private: |
| 2555 MockSyncScheduler* scheduler_; | 2555 MockSyncScheduler* scheduler_; |
| 2556 sessions::SyncSessionContext* session_context_; | 2556 sessions::SyncSessionContext* session_context_; |
| 2557 }; | 2557 }; |
| 2558 | 2558 |
| 2559 // Test that the configuration params are properly created and sent to | 2559 // Test that the configuration params are properly created and sent to |
| 2560 // ScheduleConfigure. No callback should be invoked. Any disabled datatypes | 2560 // ScheduleConfigure. No callback should be invoked. Any disabled datatypes |
| 2561 // should be purged. | 2561 // should be purged. |
| 2562 // Fails on Windows: crbug.com/139726 | |
| 2563 #if defined(OS_WIN) | |
| 2564 #define MAYBE_BasicConfiguration DISABLED_BasicConfiguration | |
| 2565 #else | |
| 2566 #define MAYBE_BasicConfiguration BasicConfiguration | |
| 2567 #endif | |
| 2562 TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) { | 2568 TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) { |
|
Sergey Ulanov
2012/07/30 23:31:40
update this to MAYBE_?
| |
| 2563 ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION; | 2569 ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION; |
| 2564 ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES); | 2570 ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES); |
| 2565 ModelSafeRoutingInfo new_routing_info; | 2571 ModelSafeRoutingInfo new_routing_info; |
| 2566 GetModelSafeRoutingInfo(&new_routing_info); | 2572 GetModelSafeRoutingInfo(&new_routing_info); |
| 2567 ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); | 2573 ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); |
| 2568 ModelTypeSet disabled_types = Difference(ModelTypeSet::All(), enabled_types); | 2574 ModelTypeSet disabled_types = Difference(ModelTypeSet::All(), enabled_types); |
| 2569 | 2575 |
| 2570 ConfigurationParams params; | 2576 ConfigurationParams params; |
| 2571 EXPECT_CALL(*scheduler(), Start(SyncScheduler::CONFIGURATION_MODE)); | 2577 EXPECT_CALL(*scheduler(), Start(SyncScheduler::CONFIGURATION_MODE)); |
| 2572 EXPECT_CALL(*scheduler(), ScheduleConfiguration(_)). | 2578 EXPECT_CALL(*scheduler(), ScheduleConfiguration(_)). |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2727 partial_types = | 2733 partial_types = |
| 2728 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()); | 2734 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()); |
| 2729 EXPECT_TRUE(partial_types.Has(NIGORI)); | 2735 EXPECT_TRUE(partial_types.Has(NIGORI)); |
| 2730 EXPECT_TRUE(partial_types.Has(BOOKMARKS)); | 2736 EXPECT_TRUE(partial_types.Has(BOOKMARKS)); |
| 2731 EXPECT_FALSE(partial_types.Has(PREFERENCES)); | 2737 EXPECT_FALSE(partial_types.Has(PREFERENCES)); |
| 2732 } | 2738 } |
| 2733 | 2739 |
| 2734 // Test CleanipDisabledTypes properly purges all disabled types as specified | 2740 // Test CleanipDisabledTypes properly purges all disabled types as specified |
| 2735 // by the previous and current enabled params. Enabled partial types should not | 2741 // by the previous and current enabled params. Enabled partial types should not |
| 2736 // be purged. | 2742 // be purged. |
| 2743 // Fails on Windows: crbug.com/139726 | |
| 2744 #if defined(OS_WIN) | |
| 2745 #define MAYBE_PurgeDisabledTypes DISABLED_PurgeDisabledTypes | |
| 2746 #else | |
| 2747 #define MAYBE_PurgeDisabledTypes PurgeDisabledTypes | |
| 2748 #endif | |
| 2737 TEST_F(SyncManagerTest, PurgeDisabledTypes) { | 2749 TEST_F(SyncManagerTest, PurgeDisabledTypes) { |
|
Sergey Ulanov
2012/07/30 23:31:40
and here
| |
| 2738 ModelSafeRoutingInfo routing_info; | 2750 ModelSafeRoutingInfo routing_info; |
| 2739 GetModelSafeRoutingInfo(&routing_info); | 2751 GetModelSafeRoutingInfo(&routing_info); |
| 2740 ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); | 2752 ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); |
| 2741 ModelTypeSet disabled_types = Difference(ModelTypeSet::All(), enabled_types); | 2753 ModelTypeSet disabled_types = Difference(ModelTypeSet::All(), enabled_types); |
| 2742 ModelTypeSet partial_enabled_types(PASSWORDS); | 2754 ModelTypeSet partial_enabled_types(PASSWORDS); |
| 2743 | 2755 |
| 2744 // Set data for all non-partial types. | 2756 // Set data for all non-partial types. |
| 2745 for (ModelTypeSet::Iterator iter = ModelTypeSet::All().First(); iter.Good(); | 2757 for (ModelTypeSet::Iterator iter = ModelTypeSet::All().First(); iter.Good(); |
| 2746 iter.Inc()) { | 2758 iter.Inc()) { |
| 2747 SetProgressMarkerForType(iter.Get(), true); | 2759 SetProgressMarkerForType(iter.Get(), true); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2765 | 2777 |
| 2766 // Verify only the non-disabled types remain after cleanup. | 2778 // Verify only the non-disabled types remain after cleanup. |
| 2767 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); | 2779 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); |
| 2768 EXPECT_TRUE(new_enabled_types.Equals( | 2780 EXPECT_TRUE(new_enabled_types.Equals( |
| 2769 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); | 2781 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); |
| 2770 EXPECT_TRUE(disabled_types.Equals( | 2782 EXPECT_TRUE(disabled_types.Equals( |
| 2771 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 2783 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
| 2772 } | 2784 } |
| 2773 | 2785 |
| 2774 } // namespace | 2786 } // namespace |
| OLD | NEW |