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

Side by Side Diff: extensions/common/features/feature_channel.h

Issue 2854293003: Fix losing of scoped feature channel in tests when it's equal to stable (Closed)
Patch Set: Take account of override count 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_CHANNEL_H_ 5 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_CHANNEL_H_
6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_CHANNEL_H_ 6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_CHANNEL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 9
10 namespace version_info { 10 namespace version_info {
11 enum class Channel; 11 enum class Channel;
12 } 12 }
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 // Gets the current channel as seen by the Feature system. 16 // Gets the current channel as seen by the Feature system.
17 version_info::Channel GetCurrentChannel(); 17 version_info::Channel GetCurrentChannel();
18 18
19 // Sets the current channel as seen by the Feature system. In the browser 19 // Sets the current channel as seen by the Feature system. In the browser
20 // process this should be chrome::GetChannel(), and in the renderer this will 20 // process this should be chrome::GetChannel(), and in the renderer this will
21 // need to come from an IPC. 21 // need to come from an IPC. Note that the value set through this function may
22 // be overridden by |ScopedCurrentChannel|.
22 void SetCurrentChannel(version_info::Channel channel); 23 void SetCurrentChannel(version_info::Channel channel);
23 24
24 // Gets the default channel as seen by the Feature system.
25 version_info::Channel GetDefaultChannel();
26
27 // Scoped channel setter. Use for tests. 25 // Scoped channel setter. Use for tests.
26 // Note that the lifetimes of multiple instances of this class must be disjoint
27 // or nested, but never overlapping.
28 class ScopedCurrentChannel { 28 class ScopedCurrentChannel {
29 public: 29 public:
30 explicit ScopedCurrentChannel(version_info::Channel channel); 30 explicit ScopedCurrentChannel(version_info::Channel channel);
31 ~ScopedCurrentChannel(); 31 ~ScopedCurrentChannel();
32 32
33 private: 33 private:
34 version_info::Channel original_channel_; 34 const version_info::Channel channel_;
35 const version_info::Channel original_overridden_channel_;
36 const int original_override_count_;
35 37
36 DISALLOW_COPY_AND_ASSIGN(ScopedCurrentChannel); 38 DISALLOW_COPY_AND_ASSIGN(ScopedCurrentChannel);
37 }; 39 };
38 40
39 } // namespace extensions 41 } // namespace extensions
40 42
41 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_CHANNEL_H_ 43 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_CHANNEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_extensions_browser_client.cc ('k') | extensions/common/features/feature_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698