| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 9 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
| 10 #include "chrome/browser/extensions/api/storage/settings_namespace.h" | 10 #include "chrome/browser/extensions/api/storage/settings_namespace.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const char kManagedStorageExtensionId[] = "kjmkgkdkpedkejedfhmfcenooemhbpbo"; | 58 const char kManagedStorageExtensionId[] = "kjmkgkdkpedkejedfhmfcenooemhbpbo"; |
| 59 | 59 |
| 60 class NoopSyncChangeProcessor : public syncer::SyncChangeProcessor { | 60 class NoopSyncChangeProcessor : public syncer::SyncChangeProcessor { |
| 61 public: | 61 public: |
| 62 virtual syncer::SyncError ProcessSyncChanges( | 62 virtual syncer::SyncError ProcessSyncChanges( |
| 63 const tracked_objects::Location& from_here, | 63 const tracked_objects::Location& from_here, |
| 64 const syncer::SyncChangeList& change_list) OVERRIDE { | 64 const syncer::SyncChangeList& change_list) OVERRIDE { |
| 65 return syncer::SyncError(); | 65 return syncer::SyncError(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const { |
| 69 return syncer::SyncDataList(); |
| 70 } |
| 71 |
| 68 virtual ~NoopSyncChangeProcessor() {}; | 72 virtual ~NoopSyncChangeProcessor() {}; |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { | 75 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { |
| 72 public: | 76 public: |
| 73 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient) | 77 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient) |
| 74 : recipient_(recipient) { | 78 : recipient_(recipient) { |
| 75 DCHECK(recipient_); | 79 DCHECK(recipient_); |
| 76 } | 80 } |
| 77 virtual ~SyncChangeProcessorDelegate() {} | 81 virtual ~SyncChangeProcessorDelegate() {} |
| 78 | 82 |
| 79 // syncer::SyncChangeProcessor implementation. | 83 // syncer::SyncChangeProcessor implementation. |
| 80 virtual syncer::SyncError ProcessSyncChanges( | 84 virtual syncer::SyncError ProcessSyncChanges( |
| 81 const tracked_objects::Location& from_here, | 85 const tracked_objects::Location& from_here, |
| 82 const syncer::SyncChangeList& change_list) OVERRIDE { | 86 const syncer::SyncChangeList& change_list) OVERRIDE { |
| 83 return recipient_->ProcessSyncChanges(from_here, change_list); | 87 return recipient_->ProcessSyncChanges(from_here, change_list); |
| 84 } | 88 } |
| 85 | 89 |
| 90 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const { |
| 91 return recipient_->GetAllSyncData(type); |
| 92 } |
| 93 |
| 86 private: | 94 private: |
| 87 // The recipient of all sync changes. | 95 // The recipient of all sync changes. |
| 88 syncer::SyncChangeProcessor* recipient_; | 96 syncer::SyncChangeProcessor* recipient_; |
| 89 | 97 |
| 90 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | 98 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); |
| 91 }; | 99 }; |
| 92 | 100 |
| 93 } // namespace | 101 } // namespace |
| 94 | 102 |
| 95 class ExtensionSettingsApiTest : public ExtensionApiTest { | 103 class ExtensionSettingsApiTest : public ExtensionApiTest { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 SettingsFrontend* frontend = | 555 SettingsFrontend* frontend = |
| 548 browser()->profile()->GetExtensionService()->settings_frontend(); | 556 browser()->profile()->GetExtensionService()->settings_frontend(); |
| 549 frontend->DisableStorageForTesting(MANAGED); | 557 frontend->DisableStorageForTesting(MANAGED); |
| 550 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); | 558 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); |
| 551 // Now run the extension. | 559 // Now run the extension. |
| 552 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) | 560 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) |
| 553 << message_; | 561 << message_; |
| 554 } | 562 } |
| 555 | 563 |
| 556 } // namespace extensions | 564 } // namespace extensions |
| OLD | NEW |