OLD | NEW |
1 // Copyright (c) 2010 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/keyboard_codes.h" | 8 #include "base/keyboard_codes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/platform_thread.h" | 11 #include "base/platform_thread.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | |
16 #include "chrome/app/chrome_dll_resource.h" | 15 #include "chrome/app/chrome_dll_resource.h" |
17 #include "chrome/browser/autocomplete/autocomplete.h" | 16 #include "chrome/browser/autocomplete/autocomplete.h" |
18 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 17 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
19 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 18 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
20 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 19 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
21 #include "chrome/browser/automation/ui_controls.h" | 20 #include "chrome/browser/automation/ui_controls.h" |
22 #include "chrome/browser/bookmarks/bookmark_model.h" | 21 #include "chrome/browser/bookmarks/bookmark_model.h" |
23 #include "chrome/browser/browser.h" | 22 #include "chrome/browser/browser.h" |
24 #include "chrome/browser/browser_window.h" | 23 #include "chrome/browser/browser_window.h" |
25 #include "chrome/browser/history/history.h" | 24 #include "chrome/browser/history/history.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Add enough history pages containing |kSearchText| to trigger open history | 225 // Add enough history pages containing |kSearchText| to trigger open history |
227 // page url in autocomplete result. | 226 // page url in autocomplete result. |
228 for (size_t i = 0; i < arraysize(kHistoryEntries); i++) { | 227 for (size_t i = 0; i < arraysize(kHistoryEntries); i++) { |
229 const TestHistoryEntry& cur = kHistoryEntries[i]; | 228 const TestHistoryEntry& cur = kHistoryEntries[i]; |
230 GURL url(cur.url); | 229 GURL url(cur.url); |
231 // Add everything in order of time. We don't want to have a time that | 230 // Add everything in order of time. We don't want to have a time that |
232 // is "right now" or it will nondeterministically appear in the results. | 231 // is "right now" or it will nondeterministically appear in the results. |
233 Time t = Time::Now() - TimeDelta::FromHours(i + 1); | 232 Time t = Time::Now() - TimeDelta::FromHours(i + 1); |
234 history_service->AddPageWithDetails(url, cur.title, cur.visit_count, | 233 history_service->AddPageWithDetails(url, cur.title, cur.visit_count, |
235 cur.typed_count, t, false); | 234 cur.typed_count, t, false); |
236 history_service->SetPageContents(url, WideToUTF16(cur.body)); | 235 history_service->SetPageContents(url, cur.body); |
237 if (cur.starred) { | 236 if (cur.starred) { |
238 bookmark_model->SetURLStarred(url, std::wstring(), true); | 237 bookmark_model->SetURLStarred(url, std::wstring(), true); |
239 } | 238 } |
240 } | 239 } |
241 } | 240 } |
242 | 241 |
243 void SetupHostResolver() { | 242 void SetupHostResolver() { |
244 for (size_t i = 0; i < arraysize(kBlockedHostnames); ++i) | 243 for (size_t i = 0; i < arraysize(kBlockedHostnames); ++i) |
245 host_resolver()->AddSimulatedFailure(kBlockedHostnames[i]); | 244 host_resolver()->AddSimulatedFailure(kBlockedHostnames[i]); |
246 } | 245 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 break; | 540 break; |
542 } | 541 } |
543 | 542 |
544 EXPECT_NE(old_text, edit_view->GetText()); | 543 EXPECT_NE(old_text, edit_view->GetText()); |
545 | 544 |
546 // Escape shall revert back to the default match item. | 545 // Escape shall revert back to the default match item. |
547 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false)); | 546 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_ESCAPE, false, false, false)); |
548 EXPECT_EQ(old_text, edit_view->GetText()); | 547 EXPECT_EQ(old_text, edit_view->GetText()); |
549 EXPECT_EQ(old_selected_line, popup_model->selected_line()); | 548 EXPECT_EQ(old_selected_line, popup_model->selected_line()); |
550 } | 549 } |
OLD | NEW |