2525#include < mutex>
2626#include < string>
2727#include < unordered_map>
28+ #include < utility>
2829#include < vector>
2930
3031#include " app/meta/move.h"
@@ -49,7 +50,8 @@ const int kCheckIntervalMillis = 100;
4950// The timeout of waiting for a Future or a listener.
5051const int kTimeOutMillis = 15000 ;
5152
52- FirestoreInternal* CreateTestFirestoreInternal (App* app);
53+ FirestoreInternal* CreateTestFirestoreInternal (
54+ App* app, const std::string& database_id = kDefaultDatabase );
5355
5456App* GetApp ();
5557App* GetApp (const char * name, const std::string& override_project_id);
@@ -252,9 +254,16 @@ class FirestoreIntegrationTest : public testing::Test {
252254 Firestore* TestFirestore (const std::string& name = kDefaultAppName ) const ;
253255
254256 // Returns a Firestore instance for an app with the given `name`, associated
255- // with the database with the given `project_id`.
256- Firestore* TestFirestoreWithProjectId (const std::string& name,
257- const std::string& project_id) const ;
257+ // with the database with the given `project_id` and default `database_id`.
258+ Firestore* TestFirestoreWithProjectId (
259+ const std::string& name,
260+ const std::string& project_id,
261+ const std::string& database_id = kDefaultDatabase ) const ;
262+
263+ // Returns a Firestore instance for an app with the given `name`, associated
264+ // with the database with the given `database_id`.
265+ Firestore* TestFirestoreWithDatabaseId (const std::string& name,
266+ const std::string& database_id) const ;
258267
259268 // Deletes the given `Firestore` instance, which must have been returned by a
260269 // previous invocation of `TestFirestore()`, and removes it from the cache of
@@ -419,15 +428,22 @@ class FirestoreIntegrationTest : public testing::Test {
419428 class FirestoreInfo {
420429 public:
421430 FirestoreInfo () = default ;
422- FirestoreInfo (const std::string& name, std::unique_ptr<Firestore> firestore)
423- : name_(name), firestore_(std::move(firestore)) {}
431+ FirestoreInfo (const std::string& name,
432+ const std::string& database_id,
433+ std::unique_ptr<Firestore> firestore)
434+ : name_(name),
435+ database_id_ (database_id),
436+ firestore_(std::move(firestore)) {}
424437
425438 const std::string& name () const { return name_; }
426439 Firestore* firestore () const { return firestore_.get (); }
440+ const std::string& database_id () const { return database_id_; }
441+
427442 void ReleaseFirestore () { firestore_.release (); }
428443
429444 private:
430445 std::string name_;
446+ std::string database_id_;
431447 std::unique_ptr<Firestore> firestore_;
432448 };
433449
0 commit comments