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

Unified Diff: chrome/browser/ui/global_error/global_error_service_browsertest.cc

Issue 2409443002: Make GlobalErrorService's ownership model slightly less insane. (Closed)
Patch Set: deprecation notice Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/global_error/global_error_service_browsertest.cc
diff --git a/chrome/browser/ui/global_error/global_error_service_browsertest.cc b/chrome/browser/ui/global_error/global_error_service_browsertest.cc
index 8ce652662a57fedf99d20013a9f2e04a7c75cda1..d7116a347e5070b5e9ab0c8b4ef5be2900b12d49 100644
--- a/chrome/browser/ui/global_error/global_error_service_browsertest.cc
+++ b/chrome/browser/ui/global_error/global_error_service_browsertest.cc
@@ -7,6 +7,7 @@
#include <memory>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/global_error/global_error.h"
@@ -71,7 +72,7 @@ IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest, ShowBubbleView) {
GlobalErrorService* service =
GlobalErrorServiceFactory::GetForProfile(browser()->profile());
- service->AddGlobalError(error);
+ service->AddGlobalError(base::WrapUnique(error));
EXPECT_EQ(error, service->GetFirstGlobalErrorWithBubbleView());
EXPECT_FALSE(error->HasShownBubbleView());
@@ -92,7 +93,7 @@ IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest, CloseBubbleView) {
GlobalErrorService* service =
GlobalErrorServiceFactory::GetForProfile(browser()->profile());
- service->AddGlobalError(error);
+ service->AddGlobalError(base::WrapUnique(error));
EXPECT_EQ(error, service->GetFirstGlobalErrorWithBubbleView());
EXPECT_FALSE(error->HasShownBubbleView());
@@ -125,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest,
GlobalErrorService* service =
GlobalErrorServiceFactory::GetForProfile(browser()->profile());
- service->AddGlobalError(error.get());
+ service->AddUnownedGlobalError(error.get());
EXPECT_EQ(error.get(), service->GetFirstGlobalErrorWithBubbleView());
error->ShowBubbleView(browser());
@@ -135,8 +136,7 @@ IN_PROC_BROWSER_TEST_F(GlobalErrorServiceBrowserTest,
// Removing |error| from profile should dismiss the bubble view without
// calling |error->BubbleViewDidClose|.
- service->RemoveGlobalError(error.get());
+ service->RemoveUnownedGlobalError(error.get());
content::RunAllPendingInMessageLoop();
EXPECT_EQ(1, error->bubble_view_close_count());
- // |error| is no longer owned by service and will be deleted.
}

Powered by Google App Engine
This is Rietveld 408576698