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

Unified Diff: chrome/browser/sync/glue/session_model_associator_unittest.cc

Issue 15055003: Do not submit: high level overview patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build. Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/session_model_associator_unittest.cc
diff --git a/chrome/browser/sync/glue/session_model_associator_unittest.cc b/chrome/browser/sync/glue/session_model_associator_unittest.cc
index e81f762c3ca0e97f0a522d1343ffdcb687cb90ef..6b7dbbaf1dd1312db0eb2e092d8604e138fa637c 100644
--- a/chrome/browser/sync/glue/session_model_associator_unittest.cc
+++ b/chrome/browser/sync/glue/session_model_associator_unittest.cc
@@ -31,6 +31,7 @@ using sessions::SerializedNavigationEntry;
using sessions::SerializedNavigationEntryTestHelper;
using testing::NiceMock;
using testing::Return;
+using testing::ReturnRef;
using testing::StrictMock;
using testing::_;
@@ -174,8 +175,8 @@ class SyncedTabDelegateMock : public SyncedTabDelegate {
SyncedTabDelegateMock() {}
virtual ~SyncedTabDelegateMock() {}
- MOCK_CONST_METHOD0(GetWindowId, SessionID::id_type());
- MOCK_CONST_METHOD0(GetSessionId, SessionID::id_type());
+ MOCK_CONST_METHOD0(GetWindowId, const SessionID&());
+ MOCK_CONST_METHOD0(GetSessionId, const SessionID&());
MOCK_CONST_METHOD0(IsBeingDestroyed, bool());
MOCK_CONST_METHOD0(profile, Profile*());
MOCK_CONST_METHOD0(GetExtensionAppId, std::string());
@@ -186,6 +187,10 @@ class SyncedTabDelegateMock : public SyncedTabDelegate {
MOCK_CONST_METHOD1(GetEntryAtIndex, content::NavigationEntry*(int i));
MOCK_CONST_METHOD0(GetActiveEntry, content::NavigationEntry*());
MOCK_CONST_METHOD0(IsPinned, bool());
+ MOCK_CONST_METHOD0(GetSyncSessionId, int64());
+ MOCK_CONST_METHOD0(IsTabInMemory, bool());
+ MOCK_METHOD1(SetSyncSessionId, void(const int64));
+
};
class SyncRefreshListener : public content::NotificationObserver {
@@ -226,6 +231,8 @@ TEST_F(SyncSessionModelAssociatorTest, ValidTabs) {
NiceMock<SyncedTabDelegateMock> tab_mock;
// A null entry shouldn't crash.
+ SessionID window_id;
+ ON_CALL(tab_mock, GetWindowId()).WillByDefault(ReturnRef(window_id));
EXPECT_CALL(tab_mock, GetCurrentEntryIndex()).WillRepeatedly(Return(0));
EXPECT_CALL(tab_mock, GetEntryAtIndex(0)).WillRepeatedly(
Return((content::NavigationEntry *)NULL));
@@ -314,7 +321,10 @@ const base::Time kTime5 = base::Time::FromInternalValue(130);
TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) {
// Create a tab with three valid entries.
NiceMock<SyncedTabDelegateMock> tab_mock;
- EXPECT_CALL(tab_mock, GetSessionId()).WillRepeatedly(Return(0));
+ SessionID window_id;
+ ON_CALL(tab_mock, GetWindowId()).WillByDefault(ReturnRef(window_id));
+ SessionID tab_id;
+ EXPECT_CALL(tab_mock, GetSessionId()).WillRepeatedly(ReturnRef(tab_id));
scoped_ptr<content::NavigationEntry> entry1(
content::NavigationEntry::Create());
entry1->SetVirtualURL(GURL("http://www.google.com"));
@@ -352,8 +362,8 @@ TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) {
session_tab.session_storage_persistent_id = "persistent id";
SetSessionTabFromDelegate(tab_mock, kTime4, &session_tab);
- EXPECT_EQ(0, session_tab.window_id.id());
- EXPECT_EQ(0, session_tab.tab_id.id());
+ EXPECT_EQ(window_id.id(), session_tab.window_id.id());
+ EXPECT_EQ(tab_id.id(), session_tab.tab_id.id());
EXPECT_EQ(0, session_tab.tab_visual_index);
EXPECT_EQ(2, session_tab.current_navigation_index);
EXPECT_FALSE(session_tab.pinned);

Powered by Google App Engine
This is Rietveld 408576698