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

Unified Diff: mandoline/ui/browser/browser_apptest.cc

Issue 1254383016: ApplicationConnection lifetime management changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mandoline/ui/browser/browser.cc ('k') | mandoline/ui/browser/desktop/desktop_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mandoline/ui/browser/browser_apptest.cc
diff --git a/mandoline/ui/browser/browser_apptest.cc b/mandoline/ui/browser/browser_apptest.cc
index f99a842ceb0cd68ee0bbe14a5ef196fe4f6fdb8d..51815b97bb90f03184854be1701e2c568d1822df 100644
--- a/mandoline/ui/browser/browser_apptest.cc
+++ b/mandoline/ui/browser/browser_apptest.cc
@@ -52,7 +52,6 @@ class BrowserTest : public mojo::test::ApplicationTestBase,
public:
BrowserTest()
: app_(nullptr),
- last_closed_connection_(nullptr),
last_browser_closed_(nullptr) {}
// Creates a new Browser object.
@@ -75,21 +74,11 @@ class BrowserTest : public mojo::test::ApplicationTestBase,
return last_browser;
}
- // Returns the last ApplicationConnection closed.
- void* last_closed_connection() {
- return last_closed_connection_;
- }
-
// Overridden from ApplicationDelegate:
void Initialize(mojo::ApplicationImpl* app) override {
app_ = app;
}
- void OnWillCloseConnection(mojo::ApplicationConnection* connection) override {
- // WARNING: DO NOT FOLLOW THIS POINTER. IT WILL BE DESTROYED.
- last_closed_connection_ = connection;
- }
-
// ApplicationTestBase:
ApplicationDelegate* GetApplicationDelegate() override { return this; }
@@ -110,7 +99,6 @@ class BrowserTest : public mojo::test::ApplicationTestBase,
private:
mojo::ApplicationImpl* app_;
- void* last_closed_connection_;
std::set<TestBrowser*> browsers_;
TestBrowser* last_browser_closed_;
scoped_ptr<base::RunLoop> browser_closed_run_loop_;
@@ -125,9 +113,13 @@ TEST_F(BrowserTest, ClosingBrowserClosesAppConnection) {
ASSERT_NE(nullptr, browser);
mojo::ApplicationConnection* view_manager_connection =
browser->view_manager_init_.connection();
+ mojo::ApplicationConnection::TestApi connection_test_api(
+ view_manager_connection);
ASSERT_NE(nullptr, view_manager_connection);
+ base::WeakPtr<mojo::ApplicationConnection> ptr =
+ connection_test_api.GetWeakPtr();
BrowserClosed(browser);
- EXPECT_EQ(last_closed_connection(), view_manager_connection);
+ EXPECT_FALSE(ptr);
}
// This test verifies that we can create two Browsers and each Browser has a
« no previous file with comments | « mandoline/ui/browser/browser.cc ('k') | mandoline/ui/browser/desktop/desktop_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698