Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/sync/profile_sync_service_session_unittest.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/sync/test_profile_sync_service.h" 34 #include "chrome/browser/sync/test_profile_sync_service.h"
35 #include "chrome/browser/sync/test/engine/test_id_factory.h" 35 #include "chrome/browser/sync/test/engine/test_id_factory.h"
36 #include "chrome/common/chrome_notification_types.h" 36 #include "chrome/common/chrome_notification_types.h"
37 #include "chrome/common/net/gaia/gaia_constants.h" 37 #include "chrome/common/net/gaia/gaia_constants.h"
38 #include "chrome/test/base/browser_with_test_window_test.h" 38 #include "chrome/test/base/browser_with_test_window_test.h"
39 #include "chrome/test/base/profile_mock.h" 39 #include "chrome/test/base/profile_mock.h"
40 #include "chrome/test/base/testing_profile.h" 40 #include "chrome/test/base/testing_profile.h"
41 #include "content/browser/browser_thread.h" 41 #include "content/browser/browser_thread.h"
42 #include "content/public/browser/notification_observer.h" 42 #include "content/public/browser/notification_observer.h"
43 #include "content/public/browser/notification_registrar.h" 43 #include "content/public/browser/notification_registrar.h"
44 #include "content/common/notification_service.h" 44 #include "content/public/browser/notification_service.h"
45 #include "googleurl/src/gurl.h" 45 #include "googleurl/src/gurl.h"
46 #include "testing/gmock/include/gmock/gmock.h" 46 #include "testing/gmock/include/gmock/gmock.h"
47 #include "testing/gtest/include/gtest/gtest.h" 47 #include "testing/gtest/include/gtest/gtest.h"
48 #include "ui/base/ui_base_types.h" 48 #include "ui/base/ui_base_types.h"
49 49
50 using browser_sync::SessionChangeProcessor; 50 using browser_sync::SessionChangeProcessor;
51 using browser_sync::SessionDataTypeController; 51 using browser_sync::SessionDataTypeController;
52 using browser_sync::SessionModelAssociator; 52 using browser_sync::SessionModelAssociator;
53 using browser_sync::SyncBackendHost; 53 using browser_sync::SyncBackendHost;
54 using sync_api::ChangeRecord; 54 using sync_api::ChangeRecord;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 io_thread_.StartWithOptions(options); 170 io_thread_.StartWithOptions(options);
171 profile()->CreateRequestContext(); 171 profile()->CreateRequestContext();
172 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 172 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
173 SessionService* session_service = new SessionService(temp_dir_.path()); 173 SessionService* session_service = new SessionService(temp_dir_.path());
174 helper_.set_service(session_service); 174 helper_.set_service(session_service);
175 service()->SetWindowType(window_id_, Browser::TYPE_TABBED); 175 service()->SetWindowType(window_id_, Browser::TYPE_TABBED);
176 service()->SetWindowBounds(window_id_, 176 service()->SetWindowBounds(window_id_,
177 window_bounds_, 177 window_bounds_,
178 ui::SHOW_STATE_NORMAL); 178 ui::SHOW_STATE_NORMAL);
179 registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, 179 registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED,
180 NotificationService::AllSources()); 180 content::NotificationService::AllSources());
181 } 181 }
182 182
183 void Observe(int type, 183 void Observe(int type,
184 const content::NotificationSource& source, 184 const content::NotificationSource& source,
185 const content::NotificationDetails& details) { 185 const content::NotificationDetails& details) {
186 switch (type) { 186 switch (type) {
187 case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED: 187 case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED:
188 notified_of_update_ = true; 188 notified_of_update_ = true;
189 break; 189 break;
190 default: 190 default:
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // Verify the now non-stale session does not get deleted. 895 // Verify the now non-stale session does not get deleted.
896 model_associator_->DeleteStaleSessions(); 896 model_associator_->DeleteStaleSessions();
897 ASSERT_TRUE(model_associator_->GetAllForeignSessions(&foreign_sessions)); 897 ASSERT_TRUE(model_associator_->GetAllForeignSessions(&foreign_sessions));
898 ASSERT_EQ(1U, foreign_sessions.size()); 898 ASSERT_EQ(1U, foreign_sessions.size());
899 std::vector<std::vector<SessionID::id_type> > session_reference; 899 std::vector<std::vector<SessionID::id_type> > session_reference;
900 session_reference.push_back(tab_list1); 900 session_reference.push_back(tab_list1);
901 VerifySyncedSession(tag, session_reference, *(foreign_sessions[0])); 901 VerifySyncedSession(tag, session_reference, *(foreign_sessions[0]));
902 } 902 }
903 903
904 } // namespace browser_sync 904 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698