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

Unified Diff: components/arc/instance_holder.h

Issue 2711033002: Fix Arc integration test. (Closed)
Patch Set: Created 3 years, 10 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: components/arc/instance_holder.h
diff --git a/components/arc/instance_holder.h b/components/arc/instance_holder.h
index fda056e646139fb48e8dc8e2773598b2ebc8ae53..894a5a7f0fbc61fd460d3657d39801227b27b8cf 100644
--- a/components/arc/instance_holder.h
+++ b/components/arc/instance_holder.h
@@ -24,6 +24,10 @@
holder)>::type::Instance::k##method_name##MinVersion, \
#method_name)
+namespace {
+bool is_instance_for_sync_test = false;
+} // namespace
+
namespace arc {
// Holds a Mojo instance+version pair. This also allows for listening for state
@@ -47,6 +51,12 @@ class InstanceHolder {
using Instance = T;
+ // In sync integration test, mutiple instances are allowed to be created for
+ // different profiles.
+ static void SetInstanceHolderForSyncTest() {
+ is_instance_for_sync_test = true;
+ }
+
InstanceHolder() = default;
// Returns true if the Mojo interface is ready at least for its version 0
@@ -99,7 +109,8 @@ class InstanceHolder {
// Passing nullptr to |instance| means closing.
void SetInstance(T* instance, uint32_t version = T::Version_) {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(instance == nullptr || instance_ == nullptr);
+ DCHECK(instance == nullptr || instance_ == nullptr ||
+ is_instance_for_sync_test);
// Note: This can be called with nullptr even if |instance_| is still
// nullptr for just in case clean up purpose. No-op in such a case.

Powered by Google App Engine
This is Rietveld 408576698