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

Side by Side Diff: chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 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
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 #include <vector> 6 #include <vector>
7 7
8 #include "apps/app_lifetime_monitor_factory.h" 8 #include "apps/app_lifetime_monitor_factory.h"
9 #include "apps/switches.h" 9 #include "apps/switches.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
12 #import "base/mac/launch_services_util.h" 12 #import "base/mac/launch_services_util.h"
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #include "base/mac/scoped_nsobject.h" 14 #include "base/mac/scoped_nsobject.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/process/launch.h" 17 #include "base/process/launch.h"
18 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
19 #include "base/test/scoped_feature_list.h" 19 #include "base/test/scoped_feature_list.h"
20 #include "base/test/test_timeouts.h" 20 #include "base/test/test_timeouts.h"
21 #include "base/threading/thread_restrictions.h"
21 #include "build/build_config.h" 22 #include "build/build_config.h"
22 #include "chrome/browser/apps/app_browsertest_util.h" 23 #include "chrome/browser/apps/app_browsertest_util.h"
23 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" 24 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h"
24 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" 25 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h"
25 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" 26 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h"
26 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/extensions/launch_util.h" 28 #include "chrome/browser/extensions/launch_util.h"
28 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/ui/browser_list.h" 30 #include "chrome/browser/ui/browser_list.h"
30 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 break; 255 break;
255 case APP_TYPE_HOSTED: 256 case APP_TYPE_HOSTED:
256 app = InstallHostedApp(); 257 app = InstallHostedApp();
257 break; 258 break;
258 } 259 }
259 260
260 // Note that usually an install triggers shim creation, but that's disabled 261 // Note that usually an install triggers shim creation, but that's disabled
261 // (always) in tests. If it wasn't the case, the following test would fail 262 // (always) in tests. If it wasn't the case, the following test would fail
262 // (but flakily since the creation happens on the FILE thread). 263 // (but flakily since the creation happens on the FILE thread).
263 shim_path_ = GetAppShimPath(profile(), app); 264 shim_path_ = GetAppShimPath(profile(), app);
265 base::ThreadRestrictions::ScopedAllowIO allow_io;
264 EXPECT_FALSE(base::PathExists(shim_path_)); 266 EXPECT_FALSE(base::PathExists(shim_path_));
265 267
266 // To create a shim in a test, instead call UpdateAllShortcuts, which has been 268 // To create a shim in a test, instead call UpdateAllShortcuts, which has been
267 // blessed by g_app_shims_allow_update_and_launch_in_tests. 269 // blessed by g_app_shims_allow_update_and_launch_in_tests.
268 base::RunLoop run_loop; 270 base::RunLoop run_loop;
269 web_app::UpdateAllShortcuts(base::string16(), profile(), app, 271 web_app::UpdateAllShortcuts(base::string16(), profile(), app,
270 run_loop.QuitClosure()); 272 run_loop.QuitClosure());
271 run_loop.Run(); 273 run_loop.Run();
272 EXPECT_TRUE(base::PathExists(shim_path_)); 274 EXPECT_TRUE(base::PathExists(shim_path_));
273 return app; 275 return app;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 // the shim is rebuilt. 626 // the shim is rebuilt.
625 WindowedAppShimLaunchObserver(app->id()).Wait(); 627 WindowedAppShimLaunchObserver(app->id()).Wait();
626 628
627 EXPECT_TRUE(GetFirstAppWindow()); 629 EXPECT_TRUE(GetFirstAppWindow());
628 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); 630 EXPECT_TRUE(HasAppShimHost(profile(), app->id()));
629 } 631 }
630 632
631 #endif // defined(ARCH_CPU_64_BITS) 633 #endif // defined(ARCH_CPU_64_BITS)
632 634
633 } // namespace apps 635 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698