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

Side by Side Diff: chrome/test/base/scoped_bundle_swizzler_mac.h

Issue 1211213003: mac: Swizzle out +[NSBundle mainBundle] for in process browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove blank line. Created 5 years, 5 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_TEST_BASE_SCOPED_BUNDLE_SWIZZLER_MAC_H_
6 #define CHROME_TEST_BASE_SCOPED_BUNDLE_SWIZZLER_MAC_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10
11 namespace base {
12 namespace mac {
13 class ScopedObjCClassSwizzler;
14 } // namespace mac
15 } // namespace base
16
17 // Within a given scope, swizzles the implementation of +[NSBundle mainBundle]
18 // to return a partial mock of the original bundle. This partial mock has a
19 // custom bundle identifier.
20 // Since this class swizzles a class method, it doesn't make sense to have more
21 // than one instance of this class in existence at the same time.
22 // The primary purpose of this class is to stub out the behavior of NSBundle for
23 // AppKit, which makes assumptions about the functionality of +[NSBundle
24 // mainBundle]. Code in Chrome should not require the use of this method, since
25 // the NSBundle is always accessed through bundle_locations.h, and that NSBundle
26 // can be directly stubbed.
27 class ScopedBundleSwizzlerMac {
28 public:
29 ScopedBundleSwizzlerMac();
30 ~ScopedBundleSwizzlerMac();
31
32 private:
33 scoped_ptr<base::mac::ScopedObjCClassSwizzler> class_swizzler_;
34 DISALLOW_COPY_AND_ASSIGN(ScopedBundleSwizzlerMac);
35 };
36
37 #endif // CHROME_TEST_BASE_SCOPED_BUNDLE_SWIZZLER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698