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

Side by Side Diff: chrome/browser/extensions/lazy_background_page_apitest.cc

Issue 2216713002: Use BookmarkModelFactory::GetForBrowserContext everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarks
Patch Set: Replace in .mm files Created 4 years, 4 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 457 }
458 458
459 // Trigger a bookmark created event and ensure both pages receive it. 459 // Trigger a bookmark created event and ensure both pages receive it.
460 { 460 {
461 ExtensionTestMessageListener listener("waiting", false); 461 ExtensionTestMessageListener listener("waiting", false);
462 ExtensionTestMessageListener listener_incognito("waiting_incognito", false); 462 ExtensionTestMessageListener listener_incognito("waiting_incognito", false);
463 463
464 LazyBackgroundObserver page_complete(browser()->profile()), 464 LazyBackgroundObserver page_complete(browser()->profile()),
465 page2_complete(incognito_browser->profile()); 465 page2_complete(incognito_browser->profile());
466 BookmarkModel* bookmark_model = 466 BookmarkModel* bookmark_model =
467 BookmarkModelFactory::GetForProfile(browser()->profile()); 467 BookmarkModelFactory::GetForBrowserContext(browser()->profile());
468 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model); 468 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model);
469 const BookmarkNode* parent = bookmark_model->bookmark_bar_node(); 469 const BookmarkNode* parent = bookmark_model->bookmark_bar_node();
470 bookmark_model->AddURL( 470 bookmark_model->AddURL(
471 parent, 0, base::ASCIIToUTF16("Title"), GURL("about:blank")); 471 parent, 0, base::ASCIIToUTF16("Title"), GURL("about:blank"));
472 page_complete.Wait(); 472 page_complete.Wait();
473 page2_complete.Wait(); 473 page2_complete.Wait();
474 474
475 // Both pages received the message. 475 // Both pages received the message.
476 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); 476 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id()));
477 EXPECT_FALSE( 477 EXPECT_FALSE(
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 EXPECT_TRUE(page_ready.WaitUntilSatisfied()); 573 EXPECT_TRUE(page_ready.WaitUntilSatisfied());
574 574
575 // After the event is sent below, wait for the event page to have received 575 // After the event is sent below, wait for the event page to have received
576 // the event before proceeding with the test. This allows the regular page 576 // the event before proceeding with the test. This allows the regular page
577 // to test that the event page received the event, which makes the pass/fail 577 // to test that the event page received the event, which makes the pass/fail
578 // logic simpler. 578 // logic simpler.
579 ExtensionTestMessageListener event_page_ready("ready", false); 579 ExtensionTestMessageListener event_page_ready("ready", false);
580 580
581 // Send an event by making a bookmark. 581 // Send an event by making a bookmark.
582 BookmarkModel* bookmark_model = 582 BookmarkModel* bookmark_model =
583 BookmarkModelFactory::GetForProfile(browser()->profile()); 583 BookmarkModelFactory::GetForBrowserContext(browser()->profile());
584 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model); 584 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model);
585 bookmarks::AddIfNotBookmarked(bookmark_model, 585 bookmarks::AddIfNotBookmarked(bookmark_model,
586 GURL("http://www.google.com"), 586 GURL("http://www.google.com"),
587 base::UTF8ToUTF16("Google")); 587 base::UTF8ToUTF16("Google"));
588 588
589 EXPECT_TRUE(event_page_ready.WaitUntilSatisfied()); 589 EXPECT_TRUE(event_page_ready.WaitUntilSatisfied());
590 590
591 page_ready.Reply("go"); 591 page_ready.Reply("go");
592 592
593 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 593 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // See https://crbug.com/612668. 689 // See https://crbug.com/612668.
690 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageIsolatedExtensionsApiTest, 690 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageIsolatedExtensionsApiTest,
691 EventProcessCleanup) { 691 EventProcessCleanup) {
692 ASSERT_TRUE(LoadExtensionAndWait("event_page_with_web_iframe")); 692 ASSERT_TRUE(LoadExtensionAndWait("event_page_with_web_iframe"));
693 693
694 // Lazy Background Page doesn't exist anymore. 694 // Lazy Background Page doesn't exist anymore.
695 EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id())); 695 EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id()));
696 } 696 }
697 697
698 } // namespace extensions 698 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698