| OLD | NEW |
| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 history_service->AddPageWithDetails(url, UTF8ToUTF16(entry.title), | 326 history_service->AddPageWithDetails(url, UTF8ToUTF16(entry.title), |
| 327 entry.visit_count, | 327 entry.visit_count, |
| 328 entry.typed_count, time, false, | 328 entry.typed_count, time, false, |
| 329 history::SOURCE_BROWSED); | 329 history::SOURCE_BROWSED); |
| 330 history_service->SetPageContents(url, UTF8ToUTF16(entry.body)); | 330 history_service->SetPageContents(url, UTF8ToUTF16(entry.body)); |
| 331 if (entry.starred) | 331 if (entry.starred) |
| 332 bookmark_utils::AddIfNotBookmarked(bookmark_model, url, string16()); | 332 bookmark_utils::AddIfNotBookmarked(bookmark_model, url, string16()); |
| 333 // Wait at least for the AddPageWithDetails() call to finish. | 333 // Wait at least for the AddPageWithDetails() call to finish. |
| 334 { | 334 { |
| 335 content::NotificationRegistrar registrar; | 335 content::NotificationRegistrar registrar; |
| 336 registrar.Add(this, chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, | 336 registrar.Add(this, chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, |
| 337 content::Source<Profile>(profile)); | 337 content::Source<Profile>(profile)); |
| 338 ui_test_utils::RunMessageLoop(); | 338 ui_test_utils::RunMessageLoop(); |
| 339 // We don't want to return until all observers have processed this | 339 // We don't want to return until all observers have processed this |
| 340 // notification, because some (e.g. the in-memory history database) may do | 340 // notification, because some (e.g. the in-memory history database) may do |
| 341 // something important. Since we don't know where in the observer list we | 341 // something important. Since we don't know where in the observer list we |
| 342 // stand, just spin the message loop once more to allow the current | 342 // stand, just spin the message loop once more to allow the current |
| 343 // callstack to complete. | 343 // callstack to complete. |
| 344 ui_test_utils::RunAllPendingInMessageLoop(); | 344 ui_test_utils::RunAllPendingInMessageLoop(); |
| 345 } | 345 } |
| 346 } | 346 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 369 | 369 |
| 370 virtual void Observe(int type, | 370 virtual void Observe(int type, |
| 371 const content::NotificationSource& source, | 371 const content::NotificationSource& source, |
| 372 const content::NotificationDetails& details) { | 372 const content::NotificationDetails& details) { |
| 373 switch (type) { | 373 switch (type) { |
| 374 case content::NOTIFICATION_TAB_CLOSED: | 374 case content::NOTIFICATION_TAB_CLOSED: |
| 375 case content::NOTIFICATION_TAB_PARENTED: | 375 case content::NOTIFICATION_TAB_PARENTED: |
| 376 case chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY: | 376 case chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY: |
| 377 case chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED: | 377 case chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED: |
| 378 case chrome::NOTIFICATION_HISTORY_LOADED: | 378 case chrome::NOTIFICATION_HISTORY_LOADED: |
| 379 case chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED: | 379 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: |
| 380 case chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED: | 380 case chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED: |
| 381 break; | 381 break; |
| 382 default: | 382 default: |
| 383 FAIL() << "Unexpected notification type"; | 383 FAIL() << "Unexpected notification type"; |
| 384 } | 384 } |
| 385 MessageLoop::current()->Quit(); | 385 MessageLoop::current()->Quit(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void BrowserAcceleratorsTest() { | 388 void BrowserAcceleratorsTest() { |
| 389 OmniboxView* omnibox_view = NULL; | 389 OmniboxView* omnibox_view = NULL; |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 | 1474 |
| 1475 // Paste text. | 1475 // Paste text. |
| 1476 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN)); | 1476 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN)); |
| 1477 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 1477 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 1478 ASSERT_TRUE(popup_model->IsOpen()); | 1478 ASSERT_TRUE(popup_model->IsOpen()); |
| 1479 | 1479 |
| 1480 // Inline autocomplete shouldn't be triggered. | 1480 // Inline autocomplete shouldn't be triggered. |
| 1481 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText()); | 1481 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText()); |
| 1482 } | 1482 } |
| 1483 #endif | 1483 #endif |
| OLD | NEW |