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

Side by Side Diff: chrome/browser/apps/ephemeral_app_browsertest.cc

Issue 284743004: Fix time outs in ephemeral apps tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "apps/saved_files_service.h" 5 #include "apps/saved_files_service.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/apps/app_browsertest_util.h" 8 #include "chrome/browser/apps/app_browsertest_util.h"
9 #include "chrome/browser/apps/ephemeral_app_service.h" 9 #include "chrome/browser/apps/ephemeral_app_service.h"
10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 10 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 bool LaunchAppAndRunTest(const Extension* app, const char* test_name) { 123 bool LaunchAppAndRunTest(const Extension* app, const char* test_name) {
124 ExtensionTestMessageListener launched_listener("launched", true); 124 ExtensionTestMessageListener launched_listener("launched", true);
125 LaunchPlatformApp(app); 125 LaunchPlatformApp(app);
126 if (!launched_listener.WaitUntilSatisfied()) { 126 if (!launched_listener.WaitUntilSatisfied()) {
127 message_ = "Failed to receive launched message from test"; 127 message_ = "Failed to receive launched message from test";
128 return false; 128 return false;
129 } 129 }
130 130
131 ResultCatcher catcher;
131 launched_listener.Reply(test_name); 132 launched_listener.Reply(test_name);
132 133
133 ResultCatcher catcher; 134 bool result = catcher.GetNextResult();
134 if (!catcher.GetNextResult()) { 135 message_ = catcher.message();
135 message_ = catcher.message();
136 return false;
137 }
138 136
139 CloseApp(app->id()); 137 CloseApp(app->id());
140 return true; 138 return result;
141 } 139 }
142 140
143 void CloseApp(const std::string& app_id) { 141 void CloseApp(const std::string& app_id) {
144 content::WindowedNotificationObserver event_page_destroyed_signal( 142 content::WindowedNotificationObserver event_page_destroyed_signal(
145 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 143 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
146 content::Source<Profile>(browser()->profile())); 144 content::Source<Profile>(browser()->profile()));
147 145
148 EXPECT_EQ(1U, GetAppWindowCountForApp(app_id)); 146 EXPECT_EQ(1U, GetAppWindowCountForApp(app_id));
149 apps::AppWindow* app_window = GetFirstAppWindowForApp(app_id); 147 apps::AppWindow* app_window = GetFirstAppWindowForApp(app_id);
150 ASSERT_TRUE(app_window); 148 ASSERT_TRUE(app_window);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 500
503 // The garbage collected app should no longer be in the preferences. 501 // The garbage collected app should no longer be in the preferences.
504 extensions_info = prefs->GetEvictedEphemeralAppsInfo(); 502 extensions_info = prefs->GetEvictedEphemeralAppsInfo();
505 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id)); 503 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id));
506 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id)); 504 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id));
507 505
508 // Reinstall the app and verify that all data has been reset. 506 // Reinstall the app and verify that all data has been reset.
509 evict_app = InstallEphemeralApp(kRetainDataApp); 507 evict_app = InstallEphemeralApp(kRetainDataApp);
510 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_; 508 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_;
511 } 509 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698