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

Side by Side Diff: chrome/browser/autocomplete/history_contents_provider_unittest.cc

Issue 2802010: Revert 49594 - Convert page contents grabbing from wide to UTF16. The current... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/437/src/
Patch Set: Created 10 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/autocomplete/autocomplete.h" 8 #include "chrome/browser/autocomplete/autocomplete.h"
9 #include "chrome/browser/autocomplete/history_contents_provider.h" 9 #include "chrome/browser/autocomplete/history_contents_provider.h"
10 #include "chrome/browser/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
11 #include "chrome/browser/history/history.h" 11 #include "chrome/browser/history/history.h"
12 #include "chrome/test/testing_profile.h" 12 #include "chrome/test/testing_profile.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 using base::Time; 15 using base::Time;
16 using base::TimeDelta; 16 using base::TimeDelta;
17 17
18 namespace { 18 namespace {
19 19
20 struct TestEntry { 20 struct TestEntry {
21 const char* url; 21 const char* url;
22 const wchar_t* title; 22 const wchar_t* title;
23 const char* body; 23 const wchar_t* body;
24 } test_entries[] = { 24 } test_entries[] = {
25 {"http://www.google.com/1", L"PAGEONE 1", "FOO some body text"}, 25 {"http://www.google.com/1", L"PAGEONE 1", L"FOO some body text"},
26 {"http://www.google.com/2", L"PAGEONE 2", "FOO some more blah blah"}, 26 {"http://www.google.com/2", L"PAGEONE 2", L"FOO some more blah blah"},
27 {"http://www.google.com/3", L"PAGETHREE 3", "BAR some hello world for you"}, 27 {"http://www.google.com/3", L"PAGETHREE 3", L"BAR some hello world for you"},
28 }; 28 };
29 29
30 class HistoryContentsProviderTest : public testing::Test, 30 class HistoryContentsProviderTest : public testing::Test,
31 public ACProviderListener { 31 public ACProviderListener {
32 public: 32 public:
33 HistoryContentsProviderTest() 33 HistoryContentsProviderTest()
34 : ui_thread_(ChromeThread::UI, &message_loop_), 34 : ui_thread_(ChromeThread::UI, &message_loop_),
35 file_thread_(ChromeThread::FILE, &message_loop_) {} 35 file_thread_(ChromeThread::FILE, &message_loop_) {}
36 36
37 void RunQuery(const AutocompleteInput& input, 37 void RunQuery(const AutocompleteInput& input,
(...skipping 28 matching lines...) Expand all
66 const void* id_scope = reinterpret_cast<void*>(1); 66 const void* id_scope = reinterpret_cast<void*>(1);
67 GURL url(test_entries[i].url); 67 GURL url(test_entries[i].url);
68 68
69 // Add everything in order of time. We don't want to have a time that 69 // Add everything in order of time. We don't want to have a time that
70 // is "right now" or it will nondeterministically appear in the results. 70 // is "right now" or it will nondeterministically appear in the results.
71 Time t = Time::Now() - TimeDelta::FromDays(arraysize(test_entries) + i); 71 Time t = Time::Now() - TimeDelta::FromDays(arraysize(test_entries) + i);
72 72
73 history_service->AddPage(url, t, id_scope, i, GURL(), 73 history_service->AddPage(url, t, id_scope, i, GURL(),
74 PageTransition::LINK, history::RedirectList(), false); 74 PageTransition::LINK, history::RedirectList(), false);
75 history_service->SetPageTitle(url, test_entries[i].title); 75 history_service->SetPageTitle(url, test_entries[i].title);
76 history_service->SetPageContents(url, UTF8ToUTF16(test_entries[i].body)); 76 history_service->SetPageContents(url, test_entries[i].body);
77 } 77 }
78 78
79 provider_ = new HistoryContentsProvider(this, profile_.get()); 79 provider_ = new HistoryContentsProvider(this, profile_.get());
80 } 80 }
81 81
82 virtual void TearDown() { 82 virtual void TearDown() {
83 provider_ = NULL; 83 provider_ = NULL;
84 profile_.reset(NULL); 84 profile_.reset(NULL);
85 } 85 }
86 86
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 ASSERT_EQ(2U, m3.size()); 181 ASSERT_EQ(2U, m3.size());
182 if (bookmark_url == m3[0].destination_url) { 182 if (bookmark_url == m3[0].destination_url) {
183 EXPECT_EQ("http://www.google.com/3", m3[1].destination_url.spec()); 183 EXPECT_EQ("http://www.google.com/3", m3[1].destination_url.spec());
184 } else { 184 } else {
185 EXPECT_EQ(bookmark_url, m3[1].destination_url); 185 EXPECT_EQ(bookmark_url, m3[1].destination_url);
186 EXPECT_EQ("http://www.google.com/3", m3[0].destination_url.spec()); 186 EXPECT_EQ("http://www.google.com/3", m3[0].destination_url.spec());
187 } 187 }
188 } 188 }
189 189
190 } // namespace 190 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698