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

Side by Side Diff: chrome/browser/sync/glue/synced_tab_delegate_unittest.cc

Issue 1309323004: Create a NavigationEntry for the initial blank page. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GetEntryCount, more tests Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/sync/glue/synced_tab_delegate.h" 5 #include "chrome/browser/sync/glue/synced_tab_delegate.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "components/sync_driver/glue/synced_window_delegate.h" 8 #include "components/sync_driver/glue/synced_window_delegate.h"
9 #include "content/public/browser/navigation_entry.h" 9 #include "content/public/browser/navigation_entry.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 26 matching lines...) Expand all
37 pending_index_(-1), 37 pending_index_(-1),
38 current_index_(0), 38 current_index_(0),
39 pending_entry_(NULL), 39 pending_entry_(NULL),
40 window_(new FakeSyncedWindowDelegate()) {} 40 window_(new FakeSyncedWindowDelegate()) {}
41 41
42 SessionID::id_type GetWindowId() const override { return 0; } 42 SessionID::id_type GetWindowId() const override { return 0; }
43 SessionID::id_type GetSessionId() const override { return 0; } 43 SessionID::id_type GetSessionId() const override { return 0; }
44 bool IsBeingDestroyed() const override { return false; } 44 bool IsBeingDestroyed() const override { return false; }
45 Profile* profile() const override { return NULL; } 45 Profile* profile() const override { return NULL; }
46 std::string GetExtensionAppId() const override { return ""; } 46 std::string GetExtensionAppId() const override { return ""; }
47 bool IsInitialBlankNavigation() const override {
48 // This differs from NavigationControllerImpl, which has an initial blank
49 // NavigationEntry.
50 return GetEntryCount() == 0;
51 }
47 int GetCurrentEntryIndex() const override { return current_index_; } 52 int GetCurrentEntryIndex() const override { return current_index_; }
48 int GetEntryCount() const override { return indexed_entries_.size(); } 53 int GetEntryCount() const override { return indexed_entries_.size(); }
49 int GetPendingEntryIndex() const override { return pending_index_; } 54 int GetPendingEntryIndex() const override { return pending_index_; }
50 content::NavigationEntry* GetPendingEntry() const override { 55 content::NavigationEntry* GetPendingEntry() const override {
51 return pending_entry_; 56 return pending_entry_;
52 } 57 }
53 content::NavigationEntry* GetEntryAtIndex(int i) const override { 58 content::NavigationEntry* GetEntryAtIndex(int i) const override {
54 return indexed_entries_[i]; 59 return indexed_entries_[i];
55 } 60 }
56 content::NavigationEntry* GetActiveEntry() const override { return NULL; } 61 content::NavigationEntry* GetActiveEntry() const override { return NULL; }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 scoped_ptr<content::NavigationEntry> 182 scoped_ptr<content::NavigationEntry>
178 entry3(content::NavigationEntry::Create()); 183 entry3(content::NavigationEntry::Create());
179 entry3->SetURL(GURL("http://www.google.com")); 184 entry3->SetURL(GURL("http://www.google.com"));
180 tab_.AppendIndexedEntry(entry3.get()); 185 tab_.AppendIndexedEntry(entry3.get());
181 186
182 // With one valid, expect true. 187 // With one valid, expect true.
183 EXPECT_TRUE(tab_.ShouldSync()); 188 EXPECT_TRUE(tab_.ShouldSync());
184 } 189 }
185 190
186 } // namespace browser_sync 191 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698