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

Side by Side Diff: chrome/browser/history/history_unittest.cc

Issue 151168: Moved typedef of RedirectList from HistoryService class to history namespace.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 // History unit tests come in two flavors: 5 // History unit tests come in two flavors:
6 // 6 //
7 // 1. The more complicated style is that the unit test creates a full history 7 // 1. The more complicated style is that the unit test creates a full history
8 // service. This spawns a background thread for the history backend, and 8 // service. This spawns a background thread for the history backend, and
9 // all communication is asynchronous. This is useful for testing more 9 // all communication is asynchronous. This is useful for testing more
10 // complicated things or end-to-end behavior. 10 // complicated things or end-to-end behavior.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 history->QueryRedirectsFrom(url, &consumer_, 234 history->QueryRedirectsFrom(url, &consumer_,
235 NewCallback(this, &HistoryTest::OnRedirectQueryComplete)); 235 NewCallback(this, &HistoryTest::OnRedirectQueryComplete));
236 MessageLoop::current()->Run(); // Will be exited in *QueryComplete. 236 MessageLoop::current()->Run(); // Will be exited in *QueryComplete.
237 return redirect_query_success_; 237 return redirect_query_success_;
238 } 238 }
239 239
240 // Callback for QueryRedirects. 240 // Callback for QueryRedirects.
241 void OnRedirectQueryComplete(HistoryService::Handle handle, 241 void OnRedirectQueryComplete(HistoryService::Handle handle,
242 GURL url, 242 GURL url,
243 bool success, 243 bool success,
244 HistoryService::RedirectList* redirects) { 244 history::RedirectList* redirects) {
245 redirect_query_success_ = success; 245 redirect_query_success_ = success;
246 if (redirect_query_success_) 246 if (redirect_query_success_)
247 saved_redirects_.swap(*redirects); 247 saved_redirects_.swap(*redirects);
248 else 248 else
249 saved_redirects_.clear(); 249 saved_redirects_.clear();
250 MessageLoop::current()->Quit(); 250 MessageLoop::current()->Quit();
251 } 251 }
252 252
253 MessageLoopForUI message_loop_; 253 MessageLoopForUI message_loop_;
254 254
255 // PageUsageData vector to test segments. 255 // PageUsageData vector to test segments.
256 ScopedVector<PageUsageData> page_usage_data_; 256 ScopedVector<PageUsageData> page_usage_data_;
257 257
258 // When non-NULL, this will be deleted on tear down and we will block until 258 // When non-NULL, this will be deleted on tear down and we will block until
259 // the backend thread has completed. This allows tests for the history 259 // the backend thread has completed. This allows tests for the history
260 // service to use this feature, but other tests to ignore this. 260 // service to use this feature, but other tests to ignore this.
261 scoped_refptr<HistoryService> history_service_; 261 scoped_refptr<HistoryService> history_service_;
262 262
263 // names of the database files 263 // names of the database files
264 FilePath history_dir_; 264 FilePath history_dir_;
265 265
266 // Set by the thumbnail callback when we get data, you should be sure to 266 // Set by the thumbnail callback when we get data, you should be sure to
267 // clear this before issuing a thumbnail request. 267 // clear this before issuing a thumbnail request.
268 bool got_thumbnail_callback_; 268 bool got_thumbnail_callback_;
269 std::vector<unsigned char> thumbnail_data_; 269 std::vector<unsigned char> thumbnail_data_;
270 270
271 // Set by the redirect callback when we get data. You should be sure to 271 // Set by the redirect callback when we get data. You should be sure to
272 // clear this before issuing a redirect request. 272 // clear this before issuing a redirect request.
273 HistoryService::RedirectList saved_redirects_; 273 history::RedirectList saved_redirects_;
274 bool redirect_query_success_; 274 bool redirect_query_success_;
275 275
276 // For history requests. 276 // For history requests.
277 CancelableRequestConsumer consumer_; 277 CancelableRequestConsumer consumer_;
278 278
279 // For saving URL info after a call to QueryURL 279 // For saving URL info after a call to QueryURL
280 bool query_url_success_; 280 bool query_url_success_;
281 URLRow query_url_row_; 281 URLRow query_url_row_;
282 VisitVector query_url_visits_; 282 VisitVector query_url_visits_;
283 283
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 TEST_F(HistoryTest, AddPage) { 378 TEST_F(HistoryTest, AddPage) {
379 scoped_refptr<HistoryService> history(new HistoryService); 379 scoped_refptr<HistoryService> history(new HistoryService);
380 history_service_ = history; 380 history_service_ = history;
381 ASSERT_TRUE(history->Init(history_dir_, NULL)); 381 ASSERT_TRUE(history->Init(history_dir_, NULL));
382 382
383 // Add the page once from a child frame. 383 // Add the page once from a child frame.
384 const GURL test_url("http://www.google.com/"); 384 const GURL test_url("http://www.google.com/");
385 history->AddPage(test_url, NULL, 0, GURL(), 385 history->AddPage(test_url, NULL, 0, GURL(),
386 PageTransition::MANUAL_SUBFRAME, 386 PageTransition::MANUAL_SUBFRAME,
387 HistoryService::RedirectList(), false); 387 history::RedirectList(), false);
388 EXPECT_TRUE(QueryURL(history, test_url)); 388 EXPECT_TRUE(QueryURL(history, test_url));
389 EXPECT_EQ(1, query_url_row_.visit_count()); 389 EXPECT_EQ(1, query_url_row_.visit_count());
390 EXPECT_EQ(0, query_url_row_.typed_count()); 390 EXPECT_EQ(0, query_url_row_.typed_count());
391 EXPECT_TRUE(query_url_row_.hidden()); // Hidden because of child frame. 391 EXPECT_TRUE(query_url_row_.hidden()); // Hidden because of child frame.
392 392
393 // Add the page once from the main frame (should unhide it). 393 // Add the page once from the main frame (should unhide it).
394 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK, 394 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK,
395 HistoryService::RedirectList(), false); 395 history::RedirectList(), false);
396 EXPECT_TRUE(QueryURL(history, test_url)); 396 EXPECT_TRUE(QueryURL(history, test_url));
397 EXPECT_EQ(2, query_url_row_.visit_count()); // Added twice. 397 EXPECT_EQ(2, query_url_row_.visit_count()); // Added twice.
398 EXPECT_EQ(0, query_url_row_.typed_count()); // Never typed. 398 EXPECT_EQ(0, query_url_row_.typed_count()); // Never typed.
399 EXPECT_FALSE(query_url_row_.hidden()); // Because loaded in main frame. 399 EXPECT_FALSE(query_url_row_.hidden()); // Because loaded in main frame.
400 } 400 }
401 401
402 TEST_F(HistoryTest, AddPageSameTimes) { 402 TEST_F(HistoryTest, AddPageSameTimes) {
403 scoped_refptr<HistoryService> history(new HistoryService); 403 scoped_refptr<HistoryService> history(new HistoryService);
404 history_service_ = history; 404 history_service_ = history;
405 ASSERT_TRUE(history->Init(history_dir_, NULL)); 405 ASSERT_TRUE(history->Init(history_dir_, NULL));
406 406
407 Time now = Time::Now(); 407 Time now = Time::Now();
408 const GURL test_urls[] = { 408 const GURL test_urls[] = {
409 GURL("http://timer.first.page/"), 409 GURL("http://timer.first.page/"),
410 GURL("http://timer.second.page/"), 410 GURL("http://timer.second.page/"),
411 GURL("http://timer.third.page/"), 411 GURL("http://timer.third.page/"),
412 }; 412 };
413 413
414 // Make sure that two pages added at the same time with no intervening 414 // Make sure that two pages added at the same time with no intervening
415 // additions have different timestamps. 415 // additions have different timestamps.
416 history->AddPage(test_urls[0], now, NULL, 0, GURL(), 416 history->AddPage(test_urls[0], now, NULL, 0, GURL(),
417 PageTransition::LINK, 417 PageTransition::LINK,
418 HistoryService::RedirectList(), false); 418 history::RedirectList(), false);
419 EXPECT_TRUE(QueryURL(history, test_urls[0])); 419 EXPECT_TRUE(QueryURL(history, test_urls[0]));
420 EXPECT_EQ(1, query_url_row_.visit_count()); 420 EXPECT_EQ(1, query_url_row_.visit_count());
421 EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time 421 EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time
422 422
423 history->AddPage(test_urls[1], now, NULL, 0, GURL(), 423 history->AddPage(test_urls[1], now, NULL, 0, GURL(),
424 PageTransition::LINK, 424 PageTransition::LINK,
425 HistoryService::RedirectList(), false); 425 history::RedirectList(), false);
426 EXPECT_TRUE(QueryURL(history, test_urls[1])); 426 EXPECT_TRUE(QueryURL(history, test_urls[1]));
427 EXPECT_EQ(1, query_url_row_.visit_count()); 427 EXPECT_EQ(1, query_url_row_.visit_count());
428 EXPECT_TRUE(now + TimeDelta::FromMicroseconds(1) == 428 EXPECT_TRUE(now + TimeDelta::FromMicroseconds(1) ==
429 query_url_row_.last_visit()); 429 query_url_row_.last_visit());
430 430
431 // Make sure the next page, at a different time, is also correct. 431 // Make sure the next page, at a different time, is also correct.
432 history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1), 432 history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1),
433 NULL, 0, GURL(), 433 NULL, 0, GURL(),
434 PageTransition::LINK, 434 PageTransition::LINK,
435 HistoryService::RedirectList(), false); 435 history::RedirectList(), false);
436 EXPECT_TRUE(QueryURL(history, test_urls[2])); 436 EXPECT_TRUE(QueryURL(history, test_urls[2]));
437 EXPECT_EQ(1, query_url_row_.visit_count()); 437 EXPECT_EQ(1, query_url_row_.visit_count());
438 EXPECT_TRUE(now + TimeDelta::FromMinutes(1) == 438 EXPECT_TRUE(now + TimeDelta::FromMinutes(1) ==
439 query_url_row_.last_visit()); 439 query_url_row_.last_visit());
440 } 440 }
441 441
442 TEST_F(HistoryTest, AddRedirect) { 442 TEST_F(HistoryTest, AddRedirect) {
443 scoped_refptr<HistoryService> history(new HistoryService); 443 scoped_refptr<HistoryService> history(new HistoryService);
444 history_service_ = history; 444 history_service_ = history;
445 ASSERT_TRUE(history->Init(history_dir_, NULL)); 445 ASSERT_TRUE(history->Init(history_dir_, NULL));
446 446
447 const char* first_sequence[] = { 447 const char* first_sequence[] = {
448 "http://first.page/", 448 "http://first.page/",
449 "http://second.page/"}; 449 "http://second.page/"};
450 int first_count = arraysize(first_sequence); 450 int first_count = arraysize(first_sequence);
451 HistoryService::RedirectList first_redirects; 451 history::RedirectList first_redirects;
452 for (int i = 0; i < first_count; i++) 452 for (int i = 0; i < first_count; i++)
453 first_redirects.push_back(GURL(first_sequence[i])); 453 first_redirects.push_back(GURL(first_sequence[i]));
454 454
455 // Add the sequence of pages as a server with no referrer. Note that we need 455 // Add the sequence of pages as a server with no referrer. Note that we need
456 // to have a non-NULL page ID scope. 456 // to have a non-NULL page ID scope.
457 history->AddPage(first_redirects.back(), MakeFakeHost(1), 0, GURL(), 457 history->AddPage(first_redirects.back(), MakeFakeHost(1), 0, GURL(),
458 PageTransition::LINK, first_redirects, true); 458 PageTransition::LINK, first_redirects, true);
459 459
460 // The first page should be added once with a link visit type (because we set 460 // The first page should be added once with a link visit type (because we set
461 // LINK when we added the original URL, and a referrer of nowhere (0). 461 // LINK when we added the original URL, and a referrer of nowhere (0).
(...skipping 17 matching lines...) Expand all
479 479
480 // Check that the redirect finding function successfully reports it. 480 // Check that the redirect finding function successfully reports it.
481 saved_redirects_.clear(); 481 saved_redirects_.clear();
482 QueryRedirectsFrom(history, first_redirects[0]); 482 QueryRedirectsFrom(history, first_redirects[0]);
483 ASSERT_EQ(1U, saved_redirects_.size()); 483 ASSERT_EQ(1U, saved_redirects_.size());
484 EXPECT_EQ(first_redirects[1], saved_redirects_[0]); 484 EXPECT_EQ(first_redirects[1], saved_redirects_[0]);
485 485
486 // Now add a client redirect from that second visit to a third, client 486 // Now add a client redirect from that second visit to a third, client
487 // redirects are tracked by the RenderView prior to updating history, 487 // redirects are tracked by the RenderView prior to updating history,
488 // so we pass in a CLIENT_REDIRECT qualifier to mock that behavior. 488 // so we pass in a CLIENT_REDIRECT qualifier to mock that behavior.
489 HistoryService::RedirectList second_redirects; 489 history::RedirectList second_redirects;
490 second_redirects.push_back(first_redirects[1]); 490 second_redirects.push_back(first_redirects[1]);
491 second_redirects.push_back(GURL("http://last.page/")); 491 second_redirects.push_back(GURL("http://last.page/"));
492 history->AddPage(second_redirects[1], MakeFakeHost(1), 1, 492 history->AddPage(second_redirects[1], MakeFakeHost(1), 1,
493 second_redirects[0], 493 second_redirects[0],
494 static_cast<PageTransition::Type>(PageTransition::LINK | 494 static_cast<PageTransition::Type>(PageTransition::LINK |
495 PageTransition::CLIENT_REDIRECT), 495 PageTransition::CLIENT_REDIRECT),
496 second_redirects, true); 496 second_redirects, true);
497 497
498 // The last page (source of the client redirect) should NOT have an 498 // The last page (source of the client redirect) should NOT have an
499 // additional visit added, because it was a client redirect (normally it 499 // additional visit added, because it was a client redirect (normally it
(...skipping 11 matching lines...) Expand all
511 } 511 }
512 512
513 TEST_F(HistoryTest, Typed) { 513 TEST_F(HistoryTest, Typed) {
514 scoped_refptr<HistoryService> history(new HistoryService); 514 scoped_refptr<HistoryService> history(new HistoryService);
515 history_service_ = history; 515 history_service_ = history;
516 ASSERT_TRUE(history->Init(history_dir_, NULL)); 516 ASSERT_TRUE(history->Init(history_dir_, NULL));
517 517
518 // Add the page once as typed. 518 // Add the page once as typed.
519 const GURL test_url("http://www.google.com/"); 519 const GURL test_url("http://www.google.com/");
520 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::TYPED, 520 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::TYPED,
521 HistoryService::RedirectList(), false); 521 history::RedirectList(), false);
522 EXPECT_TRUE(QueryURL(history, test_url)); 522 EXPECT_TRUE(QueryURL(history, test_url));
523 523
524 // We should have the same typed & visit count. 524 // We should have the same typed & visit count.
525 EXPECT_EQ(1, query_url_row_.visit_count()); 525 EXPECT_EQ(1, query_url_row_.visit_count());
526 EXPECT_EQ(1, query_url_row_.typed_count()); 526 EXPECT_EQ(1, query_url_row_.typed_count());
527 527
528 // Add the page again not typed. 528 // Add the page again not typed.
529 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK, 529 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK,
530 HistoryService::RedirectList(), false); 530 history::RedirectList(), false);
531 EXPECT_TRUE(QueryURL(history, test_url)); 531 EXPECT_TRUE(QueryURL(history, test_url));
532 532
533 // The second time should not have updated the typed count. 533 // The second time should not have updated the typed count.
534 EXPECT_EQ(2, query_url_row_.visit_count()); 534 EXPECT_EQ(2, query_url_row_.visit_count());
535 EXPECT_EQ(1, query_url_row_.typed_count()); 535 EXPECT_EQ(1, query_url_row_.typed_count());
536 536
537 // Add the page again as a generated URL. 537 // Add the page again as a generated URL.
538 history->AddPage(test_url, NULL, 0, GURL(), 538 history->AddPage(test_url, NULL, 0, GURL(),
539 PageTransition::GENERATED, HistoryService::RedirectList(), 539 PageTransition::GENERATED, history::RedirectList(),
540 false); 540 false);
541 EXPECT_TRUE(QueryURL(history, test_url)); 541 EXPECT_TRUE(QueryURL(history, test_url));
542 542
543 // This should have worked like a link click. 543 // This should have worked like a link click.
544 EXPECT_EQ(3, query_url_row_.visit_count()); 544 EXPECT_EQ(3, query_url_row_.visit_count());
545 EXPECT_EQ(1, query_url_row_.typed_count()); 545 EXPECT_EQ(1, query_url_row_.typed_count());
546 546
547 // Add the page again as a reload. 547 // Add the page again as a reload.
548 history->AddPage(test_url, NULL, 0, GURL(), 548 history->AddPage(test_url, NULL, 0, GURL(),
549 PageTransition::RELOAD, HistoryService::RedirectList(), 549 PageTransition::RELOAD, history::RedirectList(),
550 false); 550 false);
551 EXPECT_TRUE(QueryURL(history, test_url)); 551 EXPECT_TRUE(QueryURL(history, test_url));
552 552
553 // This should not have incremented any visit counts. 553 // This should not have incremented any visit counts.
554 EXPECT_EQ(3, query_url_row_.visit_count()); 554 EXPECT_EQ(3, query_url_row_.visit_count());
555 EXPECT_EQ(1, query_url_row_.typed_count()); 555 EXPECT_EQ(1, query_url_row_.typed_count());
556 } 556 }
557 557
558 TEST_F(HistoryTest, SetTitle) { 558 TEST_F(HistoryTest, SetTitle) {
559 scoped_refptr<HistoryService> history(new HistoryService); 559 scoped_refptr<HistoryService> history(new HistoryService);
(...skipping 29 matching lines...) Expand all
589 scoped_refptr<HistoryService> history(new HistoryService); 589 scoped_refptr<HistoryService> history(new HistoryService);
590 history_service_ = history; 590 history_service_ = history;
591 591
592 ASSERT_TRUE(history->Init(history_dir_, NULL)); 592 ASSERT_TRUE(history->Init(history_dir_, NULL));
593 593
594 static const void* scope = static_cast<void*>(this); 594 static const void* scope = static_cast<void*>(this);
595 595
596 // Add a URL. 596 // Add a URL.
597 const GURL existing_url("http://www.google.com/"); 597 const GURL existing_url("http://www.google.com/");
598 history->AddPage(existing_url, scope, 0, GURL(), 598 history->AddPage(existing_url, scope, 0, GURL(),
599 PageTransition::TYPED, HistoryService::RedirectList(), 599 PageTransition::TYPED, history::RedirectList(),
600 false); 600 false);
601 601
602 // Make sure a segment was created. 602 // Make sure a segment was created.
603 history->QuerySegmentUsageSince( 603 history->QuerySegmentUsageSince(
604 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, 604 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10,
605 NewCallback(static_cast<HistoryTest*>(this), 605 NewCallback(static_cast<HistoryTest*>(this),
606 &HistoryTest::OnSegmentUsageAvailable)); 606 &HistoryTest::OnSegmentUsageAvailable));
607 607
608 // Wait for processing. 608 // Wait for processing.
609 MessageLoop::current()->Run(); 609 MessageLoop::current()->Run();
610 610
611 ASSERT_EQ(1U, page_usage_data_->size()); 611 ASSERT_EQ(1U, page_usage_data_->size());
612 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); 612 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url);
613 EXPECT_DOUBLE_EQ(3.0, page_usage_data_[0]->GetScore()); 613 EXPECT_DOUBLE_EQ(3.0, page_usage_data_[0]->GetScore());
614 614
615 // Add a URL which doesn't create a segment. 615 // Add a URL which doesn't create a segment.
616 const GURL link_url("http://yahoo.com/"); 616 const GURL link_url("http://yahoo.com/");
617 history->AddPage(link_url, scope, 0, GURL(), 617 history->AddPage(link_url, scope, 0, GURL(),
618 PageTransition::LINK, HistoryService::RedirectList(), 618 PageTransition::LINK, history::RedirectList(),
619 false); 619 false);
620 620
621 // Query again 621 // Query again
622 history->QuerySegmentUsageSince( 622 history->QuerySegmentUsageSince(
623 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, 623 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10,
624 NewCallback(static_cast<HistoryTest*>(this), 624 NewCallback(static_cast<HistoryTest*>(this),
625 &HistoryTest::OnSegmentUsageAvailable)); 625 &HistoryTest::OnSegmentUsageAvailable));
626 626
627 // Wait for processing. 627 // Wait for processing.
628 MessageLoop::current()->Run(); 628 MessageLoop::current()->Run();
629 629
630 // Make sure we still have one segment. 630 // Make sure we still have one segment.
631 ASSERT_EQ(1U, page_usage_data_->size()); 631 ASSERT_EQ(1U, page_usage_data_->size());
632 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); 632 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url);
633 633
634 // Add a page linked from existing_url. 634 // Add a page linked from existing_url.
635 history->AddPage(GURL("http://www.google.com/foo"), scope, 3, existing_url, 635 history->AddPage(GURL("http://www.google.com/foo"), scope, 3, existing_url,
636 PageTransition::LINK, HistoryService::RedirectList(), 636 PageTransition::LINK, history::RedirectList(),
637 false); 637 false);
638 638
639 // Query again 639 // Query again
640 history->QuerySegmentUsageSince( 640 history->QuerySegmentUsageSince(
641 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, 641 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10,
642 NewCallback(static_cast<HistoryTest*>(this), 642 NewCallback(static_cast<HistoryTest*>(this),
643 &HistoryTest::OnSegmentUsageAvailable)); 643 &HistoryTest::OnSegmentUsageAvailable));
644 644
645 // Wait for processing. 645 // Wait for processing.
646 MessageLoop::current()->Run(); 646 MessageLoop::current()->Run();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // Creates a new HistoryAddPageArgs object for sending to the history database 755 // Creates a new HistoryAddPageArgs object for sending to the history database
756 // with reasonable defaults and the given NULL-terminated URL string. The 756 // with reasonable defaults and the given NULL-terminated URL string. The
757 // returned object will NOT be add-ref'ed, which is the responsibility of the 757 // returned object will NOT be add-ref'ed, which is the responsibility of the
758 // caller. 758 // caller.
759 HistoryAddPageArgs* MakeAddArgs(const GURL& url) { 759 HistoryAddPageArgs* MakeAddArgs(const GURL& url) {
760 return new HistoryAddPageArgs(url, 760 return new HistoryAddPageArgs(url,
761 Time::Now(), 761 Time::Now(),
762 kAddArgsScope, 762 kAddArgsScope,
763 0, 763 0,
764 GURL(), 764 GURL(),
765 HistoryService::RedirectList(), 765 history::RedirectList(),
766 PageTransition::TYPED, false); 766 PageTransition::TYPED, false);
767 } 767 }
768 768
769 // Convenience version of the above to convert a char string. 769 // Convenience version of the above to convert a char string.
770 HistoryAddPageArgs* MakeAddArgs(const char* url) { 770 HistoryAddPageArgs* MakeAddArgs(const char* url) {
771 return MakeAddArgs(GURL(url)); 771 return MakeAddArgs(GURL(url));
772 } 772 }
773 773
774 // A HistoryDBTask implementation. Each time RunOnDBThread is invoked 774 // A HistoryDBTask implementation. Each time RunOnDBThread is invoked
775 // invoke_count is increment. When invoked kWantInvokeCount times, true is 775 // invoke_count is increment. When invoked kWantInvokeCount times, true is
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 history_service_ = history; 830 history_service_ = history;
831 history->ScheduleDBTask(task.get(), &request_consumer); 831 history->ScheduleDBTask(task.get(), &request_consumer);
832 request_consumer.CancelAllRequests(); 832 request_consumer.CancelAllRequests();
833 CleanupHistoryService(); 833 CleanupHistoryService();
834 // WARNING: history has now been deleted. 834 // WARNING: history has now been deleted.
835 history = NULL; 835 history = NULL;
836 ASSERT_FALSE(task->done_invoked); 836 ASSERT_FALSE(task->done_invoked);
837 } 837 }
838 838
839 } // namespace history 839 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_types.h ('k') | chrome/browser/search_engines/template_url_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698