| 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 25 matching lines...) Expand all  Loading... | 
| 36 #include "chrome/test/base/browser_with_test_window_test.h" | 36 #include "chrome/test/base/browser_with_test_window_test.h" | 
| 37 #include "chrome/test/base/profile_mock.h" | 37 #include "chrome/test/base/profile_mock.h" | 
| 38 #include "chrome/test/base/testing_profile.h" | 38 #include "chrome/test/base/testing_profile.h" | 
| 39 #include "chrome/test/sync/engine/test_id_factory.h" | 39 #include "chrome/test/sync/engine/test_id_factory.h" | 
| 40 #include "content/browser/browser_thread.h" | 40 #include "content/browser/browser_thread.h" | 
| 41 #include "content/common/notification_observer.h" | 41 #include "content/common/notification_observer.h" | 
| 42 #include "content/common/notification_registrar.h" | 42 #include "content/common/notification_registrar.h" | 
| 43 #include "content/common/notification_service.h" | 43 #include "content/common/notification_service.h" | 
| 44 #include "testing/gmock/include/gmock/gmock.h" | 44 #include "testing/gmock/include/gmock/gmock.h" | 
| 45 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" | 
|  | 46 #include "ui/base/ui_base_types.h" | 
| 46 | 47 | 
| 47 using browser_sync::SessionChangeProcessor; | 48 using browser_sync::SessionChangeProcessor; | 
| 48 using browser_sync::SessionDataTypeController; | 49 using browser_sync::SessionDataTypeController; | 
| 49 using browser_sync::SessionModelAssociator; | 50 using browser_sync::SessionModelAssociator; | 
| 50 using browser_sync::SyncBackendHost; | 51 using browser_sync::SyncBackendHost; | 
| 51 using sync_api::SyncManager; | 52 using sync_api::SyncManager; | 
| 52 using testing::_; | 53 using testing::_; | 
| 53 using testing::Return; | 54 using testing::Return; | 
| 54 using browser_sync::TestIdFactory; | 55 using browser_sync::TestIdFactory; | 
| 55 | 56 | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 74     // BrowserWithTestWindowTest implementation. | 75     // BrowserWithTestWindowTest implementation. | 
| 75     BrowserWithTestWindowTest::SetUp(); | 76     BrowserWithTestWindowTest::SetUp(); | 
| 76     base::Thread::Options options; | 77     base::Thread::Options options; | 
| 77     options.message_loop_type = MessageLoop::TYPE_IO; | 78     options.message_loop_type = MessageLoop::TYPE_IO; | 
| 78     io_thread_.StartWithOptions(options); | 79     io_thread_.StartWithOptions(options); | 
| 79     profile()->CreateRequestContext(); | 80     profile()->CreateRequestContext(); | 
| 80     ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 81     ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 
| 81     SessionService* session_service = new SessionService(temp_dir_.path()); | 82     SessionService* session_service = new SessionService(temp_dir_.path()); | 
| 82     helper_.set_service(session_service); | 83     helper_.set_service(session_service); | 
| 83     service()->SetWindowType(window_id_, Browser::TYPE_TABBED); | 84     service()->SetWindowType(window_id_, Browser::TYPE_TABBED); | 
| 84     service()->SetWindowBounds(window_id_, window_bounds_, false); | 85     service()->SetWindowBounds(window_id_, | 
|  | 86                                window_bounds_, | 
|  | 87                                ui::SHOW_STATE_NORMAL); | 
| 85     registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, | 88     registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, | 
| 86         NotificationService::AllSources()); | 89         NotificationService::AllSources()); | 
| 87   } | 90   } | 
| 88 | 91 | 
| 89   void Observe(int type, | 92   void Observe(int type, | 
| 90       const NotificationSource& source, | 93       const NotificationSource& source, | 
| 91       const NotificationDetails& details) { | 94       const NotificationDetails& details) { | 
| 92     switch (type) { | 95     switch (type) { | 
| 93       case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED: | 96       case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED: | 
| 94         notified_of_update_ = true; | 97         notified_of_update_ = true; | 
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 444   ASSERT_FALSE(model_associator_->tab_pool_.full()); | 447   ASSERT_FALSE(model_associator_->tab_pool_.full()); | 
| 445   for (size_t i = 0; i < num_ids; ++i) { | 448   for (size_t i = 0; i < num_ids; ++i) { | 
| 446     model_associator_->tab_pool_.FreeTabNode(node_ids[i]); | 449     model_associator_->tab_pool_.FreeTabNode(node_ids[i]); | 
| 447   } | 450   } | 
| 448   ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity()); | 451   ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity()); | 
| 449   ASSERT_FALSE(model_associator_->tab_pool_.empty()); | 452   ASSERT_FALSE(model_associator_->tab_pool_.empty()); | 
| 450   ASSERT_TRUE(model_associator_->tab_pool_.full()); | 453   ASSERT_TRUE(model_associator_->tab_pool_.full()); | 
| 451 } | 454 } | 
| 452 | 455 | 
| 453 }  // namespace browser_sync | 456 }  // namespace browser_sync | 
| OLD | NEW | 
|---|