25
25
#include < mutex>
26
26
#include < string>
27
27
#include < unordered_map>
28
+ #include < utility>
28
29
#include < vector>
29
30
30
31
#include " app/meta/move.h"
@@ -49,7 +50,8 @@ const int kCheckIntervalMillis = 100;
49
50
// The timeout of waiting for a Future or a listener.
50
51
const int kTimeOutMillis = 15000 ;
51
52
52
- FirestoreInternal* CreateTestFirestoreInternal (App* app);
53
+ FirestoreInternal* CreateTestFirestoreInternal (
54
+ App* app, const std::string& database_id = kDefaultDatabase );
53
55
54
56
App* GetApp ();
55
57
App* GetApp (const char * name, const std::string& override_project_id);
@@ -252,9 +254,16 @@ class FirestoreIntegrationTest : public testing::Test {
252
254
Firestore* TestFirestore (const std::string& name = kDefaultAppName ) const ;
253
255
254
256
// 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 ;
258
267
259
268
// Deletes the given `Firestore` instance, which must have been returned by a
260
269
// previous invocation of `TestFirestore()`, and removes it from the cache of
@@ -419,15 +428,22 @@ class FirestoreIntegrationTest : public testing::Test {
419
428
class FirestoreInfo {
420
429
public:
421
430
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)) {}
424
437
425
438
const std::string& name () const { return name_; }
426
439
Firestore* firestore () const { return firestore_.get (); }
440
+ const std::string& database_id () const { return database_id_; }
441
+
427
442
void ReleaseFirestore () { firestore_.release (); }
428
443
429
444
private:
430
445
std::string name_;
446
+ std::string database_id_;
431
447
std::unique_ptr<Firestore> firestore_;
432
448
};
433
449
0 commit comments