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

Side by Side Diff: chrome/browser/tab_contents/navigation_entry_unittest.cc

Issue 165485: Renames the NavigationEntry::display_url() to virtual_url(). (Closed)
Patch Set: Created 11 years, 4 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/tab_contents/navigation_entry.h" 6 #include "chrome/browser/tab_contents/navigation_entry.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 class NavigationEntryTest : public testing::Test { 9 class NavigationEntryTest : public testing::Test {
10 public: 10 public:
(...skipping 26 matching lines...) Expand all
37 // Two entries should have different IDs by default 37 // Two entries should have different IDs by default
38 EXPECT_NE(entry1_.get()->unique_id(), entry2_.get()->unique_id()); 38 EXPECT_NE(entry1_.get()->unique_id(), entry2_.get()->unique_id());
39 39
40 // Can set an entry to have the same ID as another 40 // Can set an entry to have the same ID as another
41 entry2_.get()->set_unique_id(entry1_.get()->unique_id()); 41 entry2_.get()->set_unique_id(entry1_.get()->unique_id());
42 EXPECT_EQ(entry1_.get()->unique_id(), entry2_.get()->unique_id()); 42 EXPECT_EQ(entry1_.get()->unique_id(), entry2_.get()->unique_id());
43 } 43 }
44 44
45 // Test URL accessors 45 // Test URL accessors
46 TEST_F(NavigationEntryTest, NavigationEntryURLs) { 46 TEST_F(NavigationEntryTest, NavigationEntryURLs) {
47 // Start with no display_url (even if a url is set) 47 // Start with no virtual_url (even if a url is set)
48 EXPECT_FALSE(entry1_.get()->has_display_url()); 48 EXPECT_FALSE(entry1_.get()->has_virtual_url());
49 EXPECT_FALSE(entry2_.get()->has_display_url()); 49 EXPECT_FALSE(entry2_.get()->has_virtual_url());
50 50
51 EXPECT_EQ(GURL(), entry1_.get()->url()); 51 EXPECT_EQ(GURL(), entry1_.get()->url());
52 EXPECT_EQ(GURL(), entry1_.get()->display_url()); 52 EXPECT_EQ(GURL(), entry1_.get()->virtual_url());
53 EXPECT_TRUE(entry1_.get()->GetTitleForDisplay(NULL).empty()); 53 EXPECT_TRUE(entry1_.get()->GetTitleForDisplay(NULL).empty());
54 54
55 // Setting URL affects display_url and GetTitleForDisplay 55 // Setting URL affects virtual_url and GetTitleForDisplay
56 entry1_.get()->set_url(GURL("http://www.google.com")); 56 entry1_.get()->set_url(GURL("http://www.google.com"));
57 EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->url()); 57 EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->url());
58 EXPECT_EQ(GURL("http://www.google.com/"), entry1_.get()->display_url()); 58 EXPECT_EQ(GURL("http://www.google.com/"), entry1_.get()->virtual_url());
59 EXPECT_EQ(ASCIIToUTF16("http://www.google.com/"), 59 EXPECT_EQ(ASCIIToUTF16("http://www.google.com/"),
60 entry1_.get()->GetTitleForDisplay(NULL)); 60 entry1_.get()->GetTitleForDisplay(NULL));
61 61
62 // Title affects GetTitleForDisplay 62 // Title affects GetTitleForDisplay
63 entry1_.get()->set_title(ASCIIToUTF16("Google")); 63 entry1_.get()->set_title(ASCIIToUTF16("Google"));
64 EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay(NULL)); 64 EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay(NULL));
65 65
66 // Setting display_url doesn't affect URL 66 // Setting virtual_url doesn't affect URL
67 entry2_.get()->set_display_url(GURL("display:url")); 67 entry2_.get()->set_virtual_url(GURL("display:url"));
68 EXPECT_TRUE(entry2_.get()->has_display_url()); 68 EXPECT_TRUE(entry2_.get()->has_virtual_url());
69 EXPECT_EQ(GURL("test:url"), entry2_.get()->url()); 69 EXPECT_EQ(GURL("test:url"), entry2_.get()->url());
70 EXPECT_EQ(GURL("display:url"), entry2_.get()->display_url()); 70 EXPECT_EQ(GURL("display:url"), entry2_.get()->virtual_url());
71 71
72 // Having a title set in constructor overrides display URL 72 // Having a title set in constructor overrides virtual URL
73 EXPECT_EQ(ASCIIToUTF16("title"), entry2_.get()->GetTitleForDisplay(NULL)); 73 EXPECT_EQ(ASCIIToUTF16("title"), entry2_.get()->GetTitleForDisplay(NULL));
74 74
75 // User typed URL is independent of the others 75 // User typed URL is independent of the others
76 EXPECT_EQ(GURL(), entry1_.get()->user_typed_url()); 76 EXPECT_EQ(GURL(), entry1_.get()->user_typed_url());
77 EXPECT_EQ(GURL(), entry2_.get()->user_typed_url()); 77 EXPECT_EQ(GURL(), entry2_.get()->user_typed_url());
78 entry2_.get()->set_user_typed_url(GURL("typedurl")); 78 entry2_.get()->set_user_typed_url(GURL("typedurl"));
79 EXPECT_EQ(GURL("typedurl"), entry2_.get()->user_typed_url()); 79 EXPECT_EQ(GURL("typedurl"), entry2_.get()->user_typed_url());
80 } 80 }
81 81
82 // Test Favicon inner class 82 // Test Favicon inner class
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 EXPECT_FALSE(entry2_.get()->has_post_data()); 170 EXPECT_FALSE(entry2_.get()->has_post_data());
171 entry2_.get()->set_has_post_data(true); 171 entry2_.get()->set_has_post_data(true);
172 EXPECT_TRUE(entry2_.get()->has_post_data()); 172 EXPECT_TRUE(entry2_.get()->has_post_data());
173 173
174 // Restored 174 // Restored
175 EXPECT_FALSE(entry1_.get()->restored()); 175 EXPECT_FALSE(entry1_.get()->restored());
176 EXPECT_FALSE(entry2_.get()->restored()); 176 EXPECT_FALSE(entry2_.get()->restored());
177 entry2_.get()->set_restored(true); 177 entry2_.get()->set_restored(true);
178 EXPECT_TRUE(entry2_.get()->restored()); 178 EXPECT_TRUE(entry2_.get()->restored());
179 } 179 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_entry.cc ('k') | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698