src/sys/appmgr/storage_unittest.cc
// Test the storage directory path for a component when it doesn't have a component ID
// index.
Test the storage directory path for a component when it doesn't have a component ID
index.
Test the storage directory path for a component when it doesn ' t have a component ID index .
TEST_F(StorageTest, DirPathWithoutInstanceId) {
  auto root_realm =
      CreateRootRealm(root_storage_dir(), MakeAppmgrConfigDirWithIndex(kEmptyComponentIdIndex));
  fuchsia::sys::EnvironmentControllerPtr child_env_ctrl;
  auto child_realm = CreateChildRealm(root_realm.get(), "child_realm", child_env_ctrl.NewRequest());
  FuchsiaPkgUrl url;
  ZX_ASSERT(url.Parse("fuchsia-pkg://fuchsia.com/my_pkg#meta/my_component.cmx"));
  EXPECT_EQ(child_realm->IsolatedPathForComponentInstance(url, internal::StorageType::DATA),
            files::JoinPath(root_storage_dir(),
                            "data/r/child_realm/fuchsia.com:my_pkg:0#meta:my_component.cmx"));
  EXPECT_TRUE(files::IsDirectory(files::JoinPath(
      root_storage_dir(), "data/r/child_realm/fuchsia.com:my_pkg:0#meta:my_component.cmx")));
}
TEST_F ( StorageTest , DirPathWithoutInstanceId ) { auto root_realm = CreateRootRealm ( root_storage_dir ( ) , MakeAppmgrConfigDirWithIndex ( kEmptyComponentIdIndex ) ) ; fuchsia :: sys :: EnvironmentControllerPtr child_env_ctrl ; auto child_realm = CreateChildRealm ( root_realm . get ( ) , " " , child_env_ctrl . NewRequest ( ) ) ; FuchsiaPkgUrl url ; ZX_ASSERT ( url . Parse ( " " ) ) ; EXPECT_EQ ( child_realm -> IsolatedPathForComponentInstance ( url , internal :: StorageType :: DATA ) , files :: JoinPath ( root_storage_dir ( ) , " " ) ) ; EXPECT_TRUE ( files :: IsDirectory ( files :: JoinPath ( root_storage_dir ( ) , " " ) ) ) ; }
Test the storage directory path for a component when it doesn't have a component ID
index.
Test the storage directory path for a component when it doesn ' t have a component ID index .
// Ensure that the moniker-based directory is created.