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

Unified 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: Remember the set channel also under scoped setter 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 side-by-side diff with in-line comments
Download patch
Index: extensions/common/features/feature_channel.h
diff --git a/extensions/common/features/feature_channel.h b/extensions/common/features/feature_channel.h
index 5533e5d588ce5f6226992202997c65112ecf9350..8807132c0037c4bb0e993b81b06127abd5ef1b2c 100644
--- a/extensions/common/features/feature_channel.h
+++ b/extensions/common/features/feature_channel.h
@@ -16,22 +16,24 @@ namespace extensions {
// Gets the current channel as seen by the Feature system.
version_info::Channel GetCurrentChannel();
-// Sets the current channel as seen by the Feature system. In the browser
-// process this should be chrome::GetChannel(), and in the renderer this will
-// need to come from an IPC.
+// Sets the current channel as seen by the Feature system, unless the channel is
+// currently set through |ScopedCurrentChannel|. In the browser process this
+// should be chrome::GetChannel(), and in the renderer this will need to come
+// from an IPC.
void SetCurrentChannel(version_info::Channel channel);
-// Gets the default channel as seen by the Feature system.
-version_info::Channel GetDefaultChannel();
-
// Scoped channel setter. Use for tests.
+// Note that the lifetimes of multiple instances of this class must be disjoint
+// or nested, but never overlapping.
class ScopedCurrentChannel {
public:
explicit ScopedCurrentChannel(version_info::Channel channel);
~ScopedCurrentChannel();
private:
- version_info::Channel original_channel_;
+ const version_info::Channel channel_;
+ const version_info::Channel original_overridden_channel_;
+ const bool original_channel_is_overridden_;
DISALLOW_COPY_AND_ASSIGN(ScopedCurrentChannel);
};

Powered by Google App Engine
This is Rietveld 408576698