| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/strings/string16.h" | 5 #include "base/strings/string16.h" |
| 6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 entry1_.reset(new NavigationEntryImpl); | 24 entry1_.reset(new NavigationEntryImpl); |
| 25 | 25 |
| 26 #if !defined(OS_IOS) | 26 #if !defined(OS_IOS) |
| 27 instance_ = static_cast<SiteInstanceImpl*>(SiteInstance::Create(NULL)); | 27 instance_ = static_cast<SiteInstanceImpl*>(SiteInstance::Create(NULL)); |
| 28 #endif | 28 #endif |
| 29 entry2_.reset(new NavigationEntryImpl( | 29 entry2_.reset(new NavigationEntryImpl( |
| 30 instance_, 3, | 30 instance_, 3, |
| 31 GURL("test:url"), | 31 GURL("test:url"), |
| 32 Referrer(GURL("from"), blink::WebReferrerPolicyDefault), | 32 Referrer(GURL("from"), blink::WebReferrerPolicyDefault), |
| 33 ASCIIToUTF16("title"), | 33 ASCIIToUTF16("title"), |
| 34 PAGE_TRANSITION_TYPED, | 34 ui::PAGE_TRANSITION_TYPED, |
| 35 false)); | 35 false)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual void TearDown() { | 38 virtual void TearDown() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 scoped_ptr<NavigationEntryImpl> entry1_; | 42 scoped_ptr<NavigationEntryImpl> entry1_; |
| 43 scoped_ptr<NavigationEntryImpl> entry2_; | 43 scoped_ptr<NavigationEntryImpl> entry2_; |
| 44 // SiteInstances are deleted when their NavigationEntries are gone. | 44 // SiteInstances are deleted when their NavigationEntries are gone. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 entry2_->SetPageState(PageState::CreateFromEncodedData("state")); | 149 entry2_->SetPageState(PageState::CreateFromEncodedData("state")); |
| 150 EXPECT_EQ("state", entry2_->GetPageState().ToEncodedData()); | 150 EXPECT_EQ("state", entry2_->GetPageState().ToEncodedData()); |
| 151 | 151 |
| 152 // Page ID | 152 // Page ID |
| 153 EXPECT_EQ(-1, entry1_->GetPageID()); | 153 EXPECT_EQ(-1, entry1_->GetPageID()); |
| 154 EXPECT_EQ(3, entry2_->GetPageID()); | 154 EXPECT_EQ(3, entry2_->GetPageID()); |
| 155 entry2_->SetPageID(2); | 155 entry2_->SetPageID(2); |
| 156 EXPECT_EQ(2, entry2_->GetPageID()); | 156 EXPECT_EQ(2, entry2_->GetPageID()); |
| 157 | 157 |
| 158 // Transition type | 158 // Transition type |
| 159 EXPECT_EQ(PAGE_TRANSITION_LINK, entry1_->GetTransitionType()); | 159 EXPECT_EQ(ui::PAGE_TRANSITION_LINK, entry1_->GetTransitionType()); |
| 160 EXPECT_EQ(PAGE_TRANSITION_TYPED, entry2_->GetTransitionType()); | 160 EXPECT_EQ(ui::PAGE_TRANSITION_TYPED, entry2_->GetTransitionType()); |
| 161 entry2_->SetTransitionType(PAGE_TRANSITION_RELOAD); | 161 entry2_->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); |
| 162 EXPECT_EQ(PAGE_TRANSITION_RELOAD, entry2_->GetTransitionType()); | 162 EXPECT_EQ(ui::PAGE_TRANSITION_RELOAD, entry2_->GetTransitionType()); |
| 163 | 163 |
| 164 // Is renderer initiated | 164 // Is renderer initiated |
| 165 EXPECT_FALSE(entry1_->is_renderer_initiated()); | 165 EXPECT_FALSE(entry1_->is_renderer_initiated()); |
| 166 EXPECT_FALSE(entry2_->is_renderer_initiated()); | 166 EXPECT_FALSE(entry2_->is_renderer_initiated()); |
| 167 entry2_->set_is_renderer_initiated(true); | 167 entry2_->set_is_renderer_initiated(true); |
| 168 EXPECT_TRUE(entry2_->is_renderer_initiated()); | 168 EXPECT_TRUE(entry2_->is_renderer_initiated()); |
| 169 | 169 |
| 170 // Post Data | 170 // Post Data |
| 171 EXPECT_FALSE(entry1_->GetHasPostData()); | 171 EXPECT_FALSE(entry1_->GetHasPostData()); |
| 172 EXPECT_FALSE(entry2_->GetHasPostData()); | 172 EXPECT_FALSE(entry2_->GetHasPostData()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Content in |output| is not modified if data is not present at the key. | 237 // Content in |output| is not modified if data is not present at the key. |
| 238 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output)); | 238 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output)); |
| 239 EXPECT_EQ(test_data, output); | 239 EXPECT_EQ(test_data, output); |
| 240 // Using an empty string shows that the data is not present in the map. | 240 // Using an empty string shows that the data is not present in the map. |
| 241 base::string16 output2; | 241 base::string16 output2; |
| 242 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output2)); | 242 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output2)); |
| 243 EXPECT_EQ(ASCIIToUTF16(""), output2); | 243 EXPECT_EQ(ASCIIToUTF16(""), output2); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace content | 246 } // namespace content |
| OLD | NEW |