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

Side by Side Diff: android_webview/native/state_serializer_unittests.cc

Issue 11415292: [Search] No longer reverting omnibox text on instant search (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More tests Created 8 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "android_webview/native/state_serializer.h" 5 #include "android_webview/native/state_serializer.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 28 matching lines...) Expand all
39 39
40 scoped_ptr<content::NavigationEntry> entry( 40 scoped_ptr<content::NavigationEntry> entry(
41 content::NavigationEntry::Create()); 41 content::NavigationEntry::Create());
42 42
43 const GURL url("http://url"); 43 const GURL url("http://url");
44 const GURL virtual_url("http://virtual_url"); 44 const GURL virtual_url("http://virtual_url");
45 content::Referrer referrer; 45 content::Referrer referrer;
46 referrer.url = GURL("http://referrer_url"); 46 referrer.url = GURL("http://referrer_url");
47 referrer.policy = WebKit::WebReferrerPolicyOrigin; 47 referrer.policy = WebKit::WebReferrerPolicyOrigin;
48 const string16 title(UTF8ToUTF16("title")); 48 const string16 title(UTF8ToUTF16("title"));
49 const string16 search_terms(UTF8ToUTF16("my search terms"));
49 const string content_state("completely bogus state"); 50 const string content_state("completely bogus state");
50 const bool has_post_data = true; 51 const bool has_post_data = true;
51 const GURL original_request_url("http://original_request_url"); 52 const GURL original_request_url("http://original_request_url");
52 const GURL base_url_for_data_url("http://base_url"); 53 const GURL base_url_for_data_url("http://base_url");
53 const bool is_overriding_user_agent = true; 54 const bool is_overriding_user_agent = true;
54 const base::Time timestamp = base::Time::FromInternalValue(12345); 55 const base::Time timestamp = base::Time::FromInternalValue(12345);
55 56
56 entry->SetURL(url); 57 entry->SetURL(url);
57 entry->SetVirtualURL(virtual_url); 58 entry->SetVirtualURL(virtual_url);
58 entry->SetReferrer(referrer); 59 entry->SetReferrer(referrer);
59 entry->SetTitle(title); 60 entry->SetTitle(title);
61 entry->SetSearchTerms(search_terms);
60 entry->SetContentState(content_state); 62 entry->SetContentState(content_state);
61 entry->SetHasPostData(has_post_data); 63 entry->SetHasPostData(has_post_data);
62 entry->SetOriginalRequestURL(original_request_url); 64 entry->SetOriginalRequestURL(original_request_url);
63 entry->SetBaseURLForDataURL(base_url_for_data_url); 65 entry->SetBaseURLForDataURL(base_url_for_data_url);
64 entry->SetIsOverridingUserAgent(is_overriding_user_agent); 66 entry->SetIsOverridingUserAgent(is_overriding_user_agent);
65 entry->SetTimestamp(timestamp); 67 entry->SetTimestamp(timestamp);
66 68
67 Pickle pickle; 69 Pickle pickle;
68 bool result = internal::WriteNavigationEntryToPickle(*entry, &pickle); 70 bool result = internal::WriteNavigationEntryToPickle(*entry, &pickle);
69 EXPECT_TRUE(result); 71 EXPECT_TRUE(result);
70 72
71 scoped_ptr<content::NavigationEntry> copy(content::NavigationEntry::Create()); 73 scoped_ptr<content::NavigationEntry> copy(content::NavigationEntry::Create());
72 PickleIterator iterator(pickle); 74 PickleIterator iterator(pickle);
73 result = internal::RestoreNavigationEntryFromPickle(&iterator, copy.get()); 75 result = internal::RestoreNavigationEntryFromPickle(&iterator, copy.get());
74 EXPECT_TRUE(result); 76 EXPECT_TRUE(result);
75 77
76 EXPECT_EQ(url, copy->GetURL()); 78 EXPECT_EQ(url, copy->GetURL());
77 EXPECT_EQ(virtual_url, copy->GetVirtualURL()); 79 EXPECT_EQ(virtual_url, copy->GetVirtualURL());
78 EXPECT_EQ(referrer.url, copy->GetReferrer().url); 80 EXPECT_EQ(referrer.url, copy->GetReferrer().url);
79 EXPECT_EQ(referrer.policy, copy->GetReferrer().policy); 81 EXPECT_EQ(referrer.policy, copy->GetReferrer().policy);
80 EXPECT_EQ(title, copy->GetTitle()); 82 EXPECT_EQ(title, copy->GetTitle());
83 EXPECT_EQ(search_terms, copy->GetSearchTerms());
81 EXPECT_EQ(content_state, copy->GetContentState()); 84 EXPECT_EQ(content_state, copy->GetContentState());
82 EXPECT_EQ(has_post_data, copy->GetHasPostData()); 85 EXPECT_EQ(has_post_data, copy->GetHasPostData());
83 EXPECT_EQ(original_request_url, copy->GetOriginalRequestURL()); 86 EXPECT_EQ(original_request_url, copy->GetOriginalRequestURL());
84 EXPECT_EQ(base_url_for_data_url, copy->GetBaseURLForDataURL()); 87 EXPECT_EQ(base_url_for_data_url, copy->GetBaseURLForDataURL());
85 EXPECT_EQ(is_overriding_user_agent, copy->GetIsOverridingUserAgent()); 88 EXPECT_EQ(is_overriding_user_agent, copy->GetIsOverridingUserAgent());
86 EXPECT_EQ(timestamp, copy->GetTimestamp()); 89 EXPECT_EQ(timestamp, copy->GetTimestamp());
87 } 90 }
88 91
89 } // namespace android_webview 92 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698