OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "chrome/browser/extensions/app_notification.h" | 9 #include "chrome/browser/extensions/app_notification.h" |
10 #include "chrome/browser/extensions/app_notification_manager.h" | 10 #include "chrome/browser/extensions/app_notification_manager.h" |
11 #include "chrome/browser/sync/protocol/app_notification_specifics.pb.h" | 11 #include "chrome/browser/sync/protocol/app_notification_specifics.pb.h" |
| 12 #include "chrome/browser/sync/protocol/sync.pb.h" |
12 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
13 #include "content/test/test_browser_thread.h" | 14 #include "content/test/test_browser_thread.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 using content::BrowserThread; | 17 using content::BrowserThread; |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Extract notification guid from SyncData. | 21 // Extract notification guid from SyncData. |
21 std::string GetGuid(const SyncData& sync_data) { | 22 std::string GetGuid(const SyncData& sync_data) { |
22 return sync_data.GetSpecifics().GetExtension( | 23 return sync_data.GetSpecifics().app_notification().guid(); |
23 sync_pb::app_notification).guid(); | |
24 } | 24 } |
25 | 25 |
26 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed | 26 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed |
27 // back up to Sync. | 27 // back up to Sync. |
28 class TestChangeProcessor : public SyncChangeProcessor { | 28 class TestChangeProcessor : public SyncChangeProcessor { |
29 public: | 29 public: |
30 TestChangeProcessor() { } | 30 TestChangeProcessor() { } |
31 virtual ~TestChangeProcessor() { } | 31 virtual ~TestChangeProcessor() { } |
32 | 32 |
33 // Store a copy of all the changes passed in so we can examine them later. | 33 // Store a copy of all the changes passed in so we can examine them later. |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 | 610 |
611 EXPECT_EQ(3, processor()->change_list_size()); | 611 EXPECT_EQ(3, processor()->change_list_size()); |
612 EXPECT_TRUE(processor()->ContainsGuid(n1->guid())); | 612 EXPECT_TRUE(processor()->ContainsGuid(n1->guid())); |
613 SyncChange c1 = processor()->GetChangeByGuid(n1->guid()); | 613 SyncChange c1 = processor()->GetChangeByGuid(n1->guid()); |
614 AssertSyncChange(c1, SyncChange::ACTION_DELETE, *n1); | 614 AssertSyncChange(c1, SyncChange::ACTION_DELETE, *n1); |
615 SyncChange c2 = processor()->GetChangeByGuid(n2->guid()); | 615 SyncChange c2 = processor()->GetChangeByGuid(n2->guid()); |
616 AssertSyncChange(c2, SyncChange::ACTION_DELETE, *n2); | 616 AssertSyncChange(c2, SyncChange::ACTION_DELETE, *n2); |
617 SyncChange c3 = processor()->GetChangeByGuid(n3->guid()); | 617 SyncChange c3 = processor()->GetChangeByGuid(n3->guid()); |
618 AssertSyncChange(c3, SyncChange::ACTION_DELETE, *n3); | 618 AssertSyncChange(c3, SyncChange::ACTION_DELETE, *n3); |
619 } | 619 } |
OLD | NEW |