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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/sync/glue/session_model_associator.h" | 21 #include "chrome/browser/sync/glue/session_model_associator.h" |
22 #include "chrome/browser/sync/glue/sync_backend_host.h" | 22 #include "chrome/browser/sync/glue/sync_backend_host.h" |
23 #include "chrome/browser/sync/profile_sync_factory_mock.h" | 23 #include "chrome/browser/sync/profile_sync_factory_mock.h" |
24 #include "chrome/browser/sync/profile_sync_test_util.h" | 24 #include "chrome/browser/sync/profile_sync_test_util.h" |
25 #include "chrome/browser/sync/protocol/session_specifics.pb.h" | 25 #include "chrome/browser/sync/protocol/session_specifics.pb.h" |
26 #include "chrome/browser/sync/protocol/sync.pb.h" | 26 #include "chrome/browser/sync/protocol/sync.pb.h" |
27 #include "chrome/browser/sync/syncable/directory_manager.h" | 27 #include "chrome/browser/sync/syncable/directory_manager.h" |
28 #include "chrome/browser/sync/syncable/model_type.h" | 28 #include "chrome/browser/sync/syncable/model_type.h" |
29 #include "chrome/browser/sync/syncable/syncable.h" | 29 #include "chrome/browser/sync/syncable/syncable.h" |
30 #include "chrome/browser/sync/test_profile_sync_service.h" | 30 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 31 #include "chrome/common/chrome_notification_types.h" |
31 #include "chrome/common/net/gaia/gaia_constants.h" | 32 #include "chrome/common/net/gaia/gaia_constants.h" |
32 #include "chrome/test/browser_with_test_window_test.h" | 33 #include "chrome/test/browser_with_test_window_test.h" |
33 #include "chrome/test/profile_mock.h" | 34 #include "chrome/test/profile_mock.h" |
34 #include "chrome/test/sync/engine/test_id_factory.h" | 35 #include "chrome/test/sync/engine/test_id_factory.h" |
35 #include "chrome/test/testing_profile.h" | 36 #include "chrome/test/testing_profile.h" |
36 #include "content/browser/browser_thread.h" | 37 #include "content/browser/browser_thread.h" |
37 #include "content/common/notification_observer.h" | 38 #include "content/common/notification_observer.h" |
38 #include "content/common/notification_registrar.h" | 39 #include "content/common/notification_registrar.h" |
39 #include "content/common/notification_service.h" | 40 #include "content/common/notification_service.h" |
40 #include "testing/gmock/include/gmock/gmock.h" | 41 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 30 matching lines...) Expand all Loading... |
71 BrowserWithTestWindowTest::SetUp(); | 72 BrowserWithTestWindowTest::SetUp(); |
72 base::Thread::Options options; | 73 base::Thread::Options options; |
73 options.message_loop_type = MessageLoop::TYPE_IO; | 74 options.message_loop_type = MessageLoop::TYPE_IO; |
74 io_thread_.StartWithOptions(options); | 75 io_thread_.StartWithOptions(options); |
75 profile()->CreateRequestContext(); | 76 profile()->CreateRequestContext(); |
76 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 77 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
77 SessionService* session_service = new SessionService(temp_dir_.path()); | 78 SessionService* session_service = new SessionService(temp_dir_.path()); |
78 helper_.set_service(session_service); | 79 helper_.set_service(session_service); |
79 service()->SetWindowType(window_id_, Browser::TYPE_TABBED); | 80 service()->SetWindowType(window_id_, Browser::TYPE_TABBED); |
80 service()->SetWindowBounds(window_id_, window_bounds_, false); | 81 service()->SetWindowBounds(window_id_, window_bounds_, false); |
81 registrar_.Add(this, NotificationType::FOREIGN_SESSION_UPDATED, | 82 registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, |
82 NotificationService::AllSources()); | 83 NotificationService::AllSources()); |
83 } | 84 } |
84 | 85 |
85 void Observe(NotificationType type, | 86 void Observe(int type, |
86 const NotificationSource& source, | 87 const NotificationSource& source, |
87 const NotificationDetails& details) { | 88 const NotificationDetails& details) { |
88 switch (type.value) { | 89 switch (type) { |
89 case NotificationType::FOREIGN_SESSION_UPDATED: | 90 case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED: |
90 notified_of_update_ = true; | 91 notified_of_update_ = true; |
91 break; | 92 break; |
92 default: | 93 default: |
93 NOTREACHED(); | 94 NOTREACHED(); |
94 break; | 95 break; |
95 } | 96 } |
96 } | 97 } |
97 | 98 |
98 virtual void TearDown() { | 99 virtual void TearDown() { |
99 if (SessionServiceFactory::GetForProfileIfExisting(profile()) == service()) | 100 if (SessionServiceFactory::GetForProfileIfExisting(profile()) == service()) |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 ASSERT_FALSE(model_associator_->tab_pool_.full()); | 441 ASSERT_FALSE(model_associator_->tab_pool_.full()); |
441 for (size_t i = 0; i < num_ids; ++i) { | 442 for (size_t i = 0; i < num_ids; ++i) { |
442 model_associator_->tab_pool_.FreeTabNode(node_ids[i]); | 443 model_associator_->tab_pool_.FreeTabNode(node_ids[i]); |
443 } | 444 } |
444 ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity()); | 445 ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity()); |
445 ASSERT_FALSE(model_associator_->tab_pool_.empty()); | 446 ASSERT_FALSE(model_associator_->tab_pool_.empty()); |
446 ASSERT_TRUE(model_associator_->tab_pool_.full()); | 447 ASSERT_TRUE(model_associator_->tab_pool_.full()); |
447 } | 448 } |
448 | 449 |
449 } // namespace browser_sync | 450 } // namespace browser_sync |
OLD | NEW |