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 "base/string16.h" | 5 #include "base/string16.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "content/browser/site_instance.h" | 8 #include "content/browser/site_instance_impl.h" |
9 #include "content/browser/tab_contents/navigation_entry_impl.h" | 9 #include "content/browser/tab_contents/navigation_entry_impl.h" |
10 #include "content/public/browser/ssl_status.h" | 10 #include "content/public/browser/ssl_status.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class NavigationEntryTest : public testing::Test { | 15 class NavigationEntryTest : public testing::Test { |
16 public: | 16 public: |
17 NavigationEntryTest() : instance_(NULL) { | 17 NavigationEntryTest() : instance_(NULL) { |
18 } | 18 } |
19 | 19 |
20 virtual void SetUp() { | 20 virtual void SetUp() { |
21 entry1_.reset(new NavigationEntryImpl); | 21 entry1_.reset(new NavigationEntryImpl); |
22 | 22 |
23 instance_ = SiteInstance::CreateSiteInstance(NULL); | 23 instance_ = static_cast<SiteInstanceImpl*>(SiteInstance::Create(NULL)); |
24 entry2_.reset(new NavigationEntryImpl( | 24 entry2_.reset(new NavigationEntryImpl( |
25 instance_, 3, | 25 instance_, 3, |
26 GURL("test:url"), | 26 GURL("test:url"), |
27 Referrer(GURL("from"), WebKit::WebReferrerPolicyDefault), | 27 Referrer(GURL("from"), WebKit::WebReferrerPolicyDefault), |
28 ASCIIToUTF16("title"), | 28 ASCIIToUTF16("title"), |
29 PAGE_TRANSITION_TYPED, | 29 PAGE_TRANSITION_TYPED, |
30 false)); | 30 false)); |
31 } | 31 } |
32 | 32 |
33 virtual void TearDown() { | 33 virtual void TearDown() { |
34 } | 34 } |
35 | 35 |
36 protected: | 36 protected: |
37 scoped_ptr<NavigationEntryImpl> entry1_; | 37 scoped_ptr<NavigationEntryImpl> entry1_; |
38 scoped_ptr<NavigationEntryImpl> entry2_; | 38 scoped_ptr<NavigationEntryImpl> entry2_; |
39 // SiteInstances are deleted when their NavigationEntries are gone. | 39 // SiteInstances are deleted when their NavigationEntries are gone. |
40 SiteInstance* instance_; | 40 SiteInstanceImpl* instance_; |
41 }; | 41 }; |
42 | 42 |
43 // Test unique ID accessors | 43 // Test unique ID accessors |
44 TEST_F(NavigationEntryTest, NavigationEntryUniqueIDs) { | 44 TEST_F(NavigationEntryTest, NavigationEntryUniqueIDs) { |
45 // Two entries should have different IDs by default | 45 // Two entries should have different IDs by default |
46 EXPECT_NE(entry1_.get()->GetUniqueID(), entry2_.get()->GetUniqueID()); | 46 EXPECT_NE(entry1_.get()->GetUniqueID(), entry2_.get()->GetUniqueID()); |
47 | 47 |
48 // Can set an entry to have the same ID as another | 48 // Can set an entry to have the same ID as another |
49 entry2_.get()->set_unique_id(entry1_.get()->GetUniqueID()); | 49 entry2_.get()->set_unique_id(entry1_.get()->GetUniqueID()); |
50 EXPECT_EQ(entry1_.get()->GetUniqueID(), entry2_.get()->GetUniqueID()); | 50 EXPECT_EQ(entry1_.get()->GetUniqueID(), entry2_.get()->GetUniqueID()); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EXPECT_TRUE(entry2_.get()->GetHasPostData()); | 169 EXPECT_TRUE(entry2_.get()->GetHasPostData()); |
170 | 170 |
171 // Restored | 171 // Restored |
172 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry1_->restore_type()); | 172 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry1_->restore_type()); |
173 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry2_->restore_type()); | 173 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry2_->restore_type()); |
174 entry2_->set_restore_type(NavigationEntryImpl::RESTORE_LAST_SESSION); | 174 entry2_->set_restore_type(NavigationEntryImpl::RESTORE_LAST_SESSION); |
175 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, entry2_->restore_type()); | 175 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, entry2_->restore_type()); |
176 } | 176 } |
177 | 177 |
178 } // namespace content | 178 } // namespace content |
OLD | NEW |