diff --git a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.cc b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.cc index 62be42ba650194..277de19c6ab825 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.cc +++ b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.cc @@ -90,7 +90,7 @@ void ArcAppLaunchThrottleObserver::OnWillDestroyWatcher() { } void ArcAppLaunchThrottleObserver::OnLaunchedOrRequestExpired( - const std::string& name) { + const std::string name) { // This request has already expired or there are outstanding requests, // do not deactivate the observer. if (!current_requests_.erase(name) || current_requests_.size()) diff --git a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.h b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.h index 7539e4f06571cb..965f3b0c3be019 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.h +++ b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer.h @@ -59,7 +59,7 @@ class ArcAppLaunchThrottleObserver void OnWillDestroyWatcher() override; private: - void OnLaunchedOrRequestExpired(const std::string& name); + void OnLaunchedOrRequestExpired(const std::string name); std::set current_requests_; diff --git a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc index d8964c877fa3fe..071b716e066b52 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc +++ b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc @@ -148,5 +148,14 @@ TEST_F(ArcAppLaunchThrottleObserverTest, TestWindowWatcherEffectOnInit) { } } +TEST_F(ArcAppLaunchThrottleObserverTest, TestCallbackString) { + auto temp_id = std::make_unique("test_app_id"); + observer()->OnArcAppLaunchRequested(*temp_id); + temp_id.reset(); + + // Expect no crash & memory leak. + environment()->FastForwardUntilNoTasksRemain(); +} + } // namespace } // namespace arc