Merge from Chromium at DEPS revision 40.0.2214.89

This commit was generated by merge_to_master.py.

Change-Id: Ie5cbec1748e252af0bfed0f0172022bd46c3178c
diff --git a/base/android/java/src/org/chromium/base/library_loader/Linker.java b/base/android/java/src/org/chromium/base/library_loader/Linker.java
index d58d1fc..dfcc141 100644
--- a/base/android/java/src/org/chromium/base/library_loader/Linker.java
+++ b/base/android/java/src/org/chromium/base/library_loader/Linker.java
@@ -845,6 +845,16 @@
      */
     public static boolean checkMapExecSupport(String apkFile) {
         assert apkFile != null;
+
+        // https://code.google.com/p/chromium/issues/detail?id=448084
+        // Do not check if the device is Samsung Mega.
+        final String model = android.os.Build.MODEL;
+        if (model != null && model.equals("GT-I9205")) {
+            if (DEBUG) Log.i(TAG, "checkMapExecSupport: model is '" + model
+                             + "', returning false");
+            return false;
+        }
+
         synchronized (Linker.class) {
             ensureInitializedLocked();
 
diff --git a/build/util/LASTCHANGE b/build/util/LASTCHANGE
index da4f812..e26e6ab 100644
--- a/build/util/LASTCHANGE
+++ b/build/util/LASTCHANGE
@@ -1 +1 @@
-LASTCHANGE=f7ea06d7fca4
+LASTCHANGE=7d165fc0b2d2
diff --git a/build/util/LASTCHANGE.blink b/build/util/LASTCHANGE.blink
index 90859f4..851763d 100644
--- a/build/util/LASTCHANGE.blink
+++ b/build/util/LASTCHANGE.blink
@@ -1 +1 @@
-LASTCHANGE=188344
+LASTCHANGE=188492
diff --git a/chrome/VERSION b/chrome/VERSION
index f9f622d..0c9685f 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
 MAJOR=40
 MINOR=0
 BUILD=2214
-PATCH=87
+PATCH=89
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
index e8b4781..dda3131 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
@@ -1023,7 +1023,9 @@
 
         destroyContentViewCoreInternal(mContentViewCore);
 
-        mContentViewParent.removeAllViews();
+        if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null) {
+            mInfoBarContainer.removeFromParentView();
+        }
         mContentViewParent = null;
         mContentViewCore.destroy();
 
diff --git a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
index 7e63ac7..f9b0198 100644
--- a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
+++ b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
@@ -139,7 +139,7 @@
       KioskAppUpdateServiceFactory::GetForProfile(profile);
   DCHECK(update_service);
   if (update_service)
-    update_service->set_app_id(app_id);
+    update_service->Init(app_id);
 
   // Start to monitor external update from usb stick.
   KioskAppManager::Get()->MonitorKioskExternalUpdate();
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc
index ea96dd6..0c0266e 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc
@@ -34,6 +34,15 @@
     system::AutomaticRebootManager* automatic_reboot_manager)
     : profile_(profile),
       automatic_reboot_manager_(automatic_reboot_manager) {
+}
+
+KioskAppUpdateService::~KioskAppUpdateService() {
+}
+
+void KioskAppUpdateService::Init(const std::string& app_id) {
+  DCHECK(app_id_.empty());
+  app_id_ = app_id;
+
   ExtensionService* service =
       extensions::ExtensionSystem::Get(profile_)->extension_service();
   if (service)
@@ -44,9 +53,9 @@
 
   if (KioskAppManager::Get())
     KioskAppManager::Get()->AddObserver(this);
-}
 
-KioskAppUpdateService::~KioskAppUpdateService() {
+  if (automatic_reboot_manager_->reboot_requested())
+    OnRebootRequested(automatic_reboot_manager_->reboot_reason());
 }
 
 void KioskAppUpdateService::StartAppUpdateRestartTimer() {
@@ -72,6 +81,8 @@
     service->RemoveUpdateObserver(this);
   if (KioskAppManager::Get())
     KioskAppManager::Get()->RemoveObserver(this);
+  if (automatic_reboot_manager_)
+    automatic_reboot_manager_->RemoveObserver(this);
 }
 
 void KioskAppUpdateService::OnAppUpdateAvailable(
@@ -93,7 +104,7 @@
   StartAppUpdateRestartTimer();
 }
 
-void KioskAppUpdateService::OnRebootScheduled(Reason reason) {
+void KioskAppUpdateService::OnRebootRequested(Reason reason) {
   extensions::core_api::runtime::OnRestartRequired::Reason restart_reason =
       extensions::core_api::runtime::OnRestartRequired::REASON_NONE;
   switch (reason) {
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h
index 73c7836..5ba406f 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h
@@ -40,7 +40,8 @@
       system::AutomaticRebootManager* automatic_reboot_manager);
   virtual ~KioskAppUpdateService();
 
-  void set_app_id(const std::string& app_id) { app_id_ = app_id; }
+  void Init(const std::string& app_id);
+
   std::string get_app_id() const { return app_id_; }
 
  private:
@@ -58,7 +59,7 @@
   virtual void OnChromeUpdateAvailable() override {}
 
   // system::AutomaticRebootManagerObserver overrides:
-  virtual void OnRebootScheduled(Reason reason) override;
+  virtual void OnRebootRequested(Reason reason) override;
   virtual void WillDestroyAutomaticRebootManager() override;
 
   // KioskAppManagerObserver overrides:
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc b/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc
index 970eeeb..059082d 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc
@@ -14,6 +14,7 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/prefs/pref_service.h"
+#include "base/run_loop.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/test/scoped_path_override.h"
 #include "base/threading/sequenced_worker_pool.h"
@@ -22,26 +23,32 @@
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/browser_process_platform_part.h"
 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h"
+#include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/pref_names.h"
 #include "chromeos/chromeos_paths.h"
 #include "chromeos/dbus/update_engine_client.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/test/test_utils.h"
 #include "extensions/common/extension.h"
 #include "extensions/test/extension_test_message_listener.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
 
-class KioskAppUpdateServiceTest : public extensions::PlatformAppBrowserTest {
+class KioskAppUpdateServiceTest
+    : public extensions::PlatformAppBrowserTest,
+      public system::AutomaticRebootManagerObserver {
  public:
-  KioskAppUpdateServiceTest() : app_(NULL), update_service_(NULL) {}
-  virtual ~KioskAppUpdateServiceTest() {}
+  KioskAppUpdateServiceTest()
+      : app_(NULL),
+        update_service_(NULL),
+        automatic_reboot_manager_(NULL) {}
+
+  ~KioskAppUpdateServiceTest() override {}
 
   // extensions::PlatformAppBrowserTest overrides:
-  virtual void SetUpOnMainThread() override {
+  void SetUpOnMainThread() override {
     extensions::PlatformAppBrowserTest::SetUpOnMainThread();
 
     ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
@@ -65,10 +72,26 @@
     command->AppendSwitch(switches::kForceAppMode);
     command->AppendSwitchASCII(switches::kAppId, app_->id());
 
-    update_service_ = KioskAppUpdateServiceFactory::GetForProfile(profile());
-    update_service_->set_app_id(app_->id());
+    automatic_reboot_manager_ =
+        g_browser_process->platform_part()->automatic_reboot_manager();
+    automatic_reboot_manager_->AddObserver(this);
+  }
 
-    content::RunAllBlockingPoolTasksUntilIdle();
+  // system::AutomaticRebootManagerObserver:
+  void OnRebootRequested(
+      system::AutomaticRebootManagerObserver::Reason) override {
+    if (run_loop_)
+      run_loop_->Quit();
+  }
+
+  void WillDestroyAutomaticRebootManager() override {
+    automatic_reboot_manager_->RemoveObserver(this);
+  }
+
+  void CreateKioskAppUpdateService() {
+    EXPECT_FALSE(update_service_);
+    update_service_ = KioskAppUpdateServiceFactory::GetForProfile(profile());
+    update_service_->Init(app_->id());
   }
 
   void FireAppUpdateAvailable() {
@@ -78,8 +101,16 @@
   void FireUpdatedNeedReboot() {
     UpdateEngineClient::Status status;
     status.status = UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT;
-    g_browser_process->platform_part()->automatic_reboot_manager()->
-        UpdateStatusChanged(status);
+    run_loop_.reset(new base::RunLoop);
+    automatic_reboot_manager_->UpdateStatusChanged(status);
+    run_loop_->Run();
+  }
+
+  void RequestPeriodicReboot() {
+    run_loop_.reset(new base::RunLoop);
+    g_browser_process->local_state()->SetInteger(
+        prefs::kUptimeLimit, base::TimeDelta::FromMinutes(30).InSeconds());
+    run_loop_->Run();
   }
 
  private:
@@ -87,30 +118,63 @@
   scoped_ptr<base::ScopedPathOverride> uptime_file_override_;
   const extensions::Extension* app_;  // Not owned.
   KioskAppUpdateService* update_service_;  // Not owned.
+  system::AutomaticRebootManager* automatic_reboot_manager_;  // Not owned.
+  scoped_ptr<base::RunLoop> run_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateServiceTest);
 };
 
+// Verifies that the app is notified a reboot is required when an app update
+// becomes available.
 IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, AppUpdate) {
-  FireAppUpdateAvailable();
+  CreateKioskAppUpdateService();
 
   ExtensionTestMessageListener listener("app_update", false);
+  FireAppUpdateAvailable();
   listener.WaitUntilSatisfied();
 }
 
+// Verifies that the app is notified a reboot is required when an OS update is
+// applied while Chrome is running and the policy to reboot after update is
+// enabled.
 IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, OsUpdate) {
+  CreateKioskAppUpdateService();
+
+  g_browser_process->local_state()->SetBoolean(prefs::kRebootAfterUpdate, true);
+  ExtensionTestMessageListener listener("os_update", false);
+  FireUpdatedNeedReboot();
+  listener.WaitUntilSatisfied();
+}
+
+// Verifies that the app is notified a reboot is required when a periodic reboot
+// is requested while Chrome is running.
+IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, Periodic) {
+  CreateKioskAppUpdateService();
+
+  ExtensionTestMessageListener listener("periodic", false);
+  RequestPeriodicReboot();
+  listener.WaitUntilSatisfied();
+}
+
+// Verifies that the app is notified a reboot is required when an OS update was
+// applied before Chrome was started and the policy to reboot after update is
+// enabled.
+IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, StartAfterOsUpdate) {
   g_browser_process->local_state()->SetBoolean(prefs::kRebootAfterUpdate, true);
   FireUpdatedNeedReboot();
 
   ExtensionTestMessageListener listener("os_update", false);
+  CreateKioskAppUpdateService();
   listener.WaitUntilSatisfied();
 }
 
-IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, Periodic) {
-  g_browser_process->local_state()->SetInteger(
-      prefs::kUptimeLimit, base::TimeDelta::FromMinutes(30).InSeconds());
+// Verifies that the app is notified a reboot is required when a periodic reboot
+// was requested before Chrome was started.
+IN_PROC_BROWSER_TEST_F(KioskAppUpdateServiceTest, StartAfterPeriodic) {
+  RequestPeriodicReboot();
 
   ExtensionTestMessageListener listener("periodic", false);
+  CreateKioskAppUpdateService();
   listener.WaitUntilSatisfied();
 }
 
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager.cc b/chrome/browser/chromeos/system/automatic_reboot_manager.cc
index 81d6dcd..c1b5c90 100644
--- a/chrome/browser/chromeos/system/automatic_reboot_manager.cc
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager.cc
@@ -32,7 +32,6 @@
 #include "base/time/tick_clock.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
 #include "chrome/common/pref_names.h"
 #include "chromeos/chromeos_paths.h"
 #include "chromeos/chromeos_switches.h"
@@ -151,6 +150,7 @@
     : clock_(clock.Pass()),
       have_boot_time_(false),
       have_update_reboot_needed_time_(false),
+      reboot_reason_(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN),
       reboot_requested_(false),
       weak_ptr_factory_(this) {
   local_state_registrar_.Init(g_browser_process->local_state());
@@ -226,7 +226,7 @@
   // so that only the time of the first notification is taken into account and
   // repeated notifications do not postpone the reboot request and grace period.
   if (status.status != UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT ||
-      !have_boot_time_ || have_update_reboot_needed_time_) {
+      have_update_reboot_needed_time_) {
     return;
   }
 
@@ -317,8 +317,6 @@
   reboot_requested_ = false;
 
   const base::TimeDelta kZeroTimeDelta;
-  AutomaticRebootManagerObserver::Reason reboot_reason =
-      AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN;
 
   // If an uptime limit is set, calculate the time at which it should cause a
   // reboot to be requested.
@@ -327,7 +325,7 @@
   base::TimeTicks reboot_request_time = boot_time_ + uptime_limit;
   bool have_reboot_request_time = uptime_limit != kZeroTimeDelta;
   if (have_reboot_request_time)
-    reboot_reason = AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC;
+    reboot_reason_ = AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC;
 
   // If the policy to automatically reboot after an update is enabled and an
   // update has been applied, set the time at which a reboot should be
@@ -339,7 +337,7 @@
        update_reboot_needed_time_ < reboot_request_time)) {
     reboot_request_time = update_reboot_needed_time_;
     have_reboot_request_time = true;
-    reboot_reason = AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE;
+    reboot_reason_ = AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE;
   }
 
   // If no reboot should be requested, remove any grace period.
@@ -375,15 +373,15 @@
                           base::Bind(&AutomaticRebootManager::Reboot,
                                      base::Unretained(this)));
 
-  DCHECK_NE(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN,
-            reboot_reason);
-  FOR_EACH_OBSERVER(AutomaticRebootManagerObserver,
-                    observers_,
-                    OnRebootScheduled(reboot_reason));
 }
 
 void AutomaticRebootManager::RequestReboot() {
   reboot_requested_ = true;
+  DCHECK_NE(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN,
+            reboot_reason_);
+  FOR_EACH_OBSERVER(AutomaticRebootManagerObserver,
+                    observers_,
+                    OnRebootRequested(reboot_reason_));
   MaybeReboot(false);
 }
 
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager.h b/chrome/browser/chromeos/system/automatic_reboot_manager.h
index 638c9ac..5ecf8d6 100644
--- a/chrome/browser/chromeos/system/automatic_reboot_manager.h
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager.h
@@ -13,6 +13,7 @@
 #include "base/prefs/pref_change_registrar.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
+#include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
 #include "chromeos/dbus/power_manager_client.h"
 #include "chromeos/dbus/update_engine_client.h"
 #include "content/public/browser/notification_observer.h"
@@ -28,8 +29,6 @@
 namespace chromeos {
 namespace system {
 
-class AutomaticRebootManagerObserver;
-
 // Schedules and executes automatic reboots.
 //
 // Automatic reboots may be scheduled for any number of reasons. Currently, the
@@ -93,6 +92,11 @@
   explicit AutomaticRebootManager(scoped_ptr<base::TickClock> clock);
   virtual ~AutomaticRebootManager();
 
+  AutomaticRebootManagerObserver::Reason reboot_reason() const {
+    return reboot_reason_;
+  }
+  bool reboot_requested() const { return reboot_requested_; }
+
   void AddObserver(AutomaticRebootManagerObserver* observer);
   void RemoveObserver(AutomaticRebootManagerObserver* observer);
 
@@ -157,6 +161,9 @@
   bool have_update_reboot_needed_time_;
   base::TimeTicks update_reboot_needed_time_;
 
+  // The reason for the reboot request. Updated whenever a reboot is scheduled.
+  AutomaticRebootManagerObserver::Reason reboot_reason_;
+
   // Whether a reboot has been requested.
   bool reboot_requested_;
 
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager_observer.h b/chrome/browser/chromeos/system/automatic_reboot_manager_observer.h
index 67c1b50..0a750bc 100644
--- a/chrome/browser/chromeos/system/automatic_reboot_manager_observer.h
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager_observer.h
@@ -16,8 +16,8 @@
     REBOOT_REASON_PERIODIC,
   };
 
-  // Invoked when a reboot is scheduled.
-  virtual void OnRebootScheduled(Reason reason) = 0;
+  // Invoked when a reboot is requested.
+  virtual void OnRebootRequested(Reason reason) = 0;
 
   // Invoked before the automatic reboot manager is destroyed.
   virtual void WillDestroyAutomaticRebootManager() = 0;
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc
index 6a23376..4f00912 100644
--- a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc
@@ -29,6 +29,7 @@
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
+#include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/test/base/testing_browser_process.h"
 #include "chromeos/chromeos_paths.h"
@@ -44,6 +45,9 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/message_center/message_center.h"
 
+using ::testing::_;
+using ::testing::Invoke;
+using ::testing::Mock;
 using ::testing::ReturnPointee;
 
 namespace chromeos {
@@ -115,6 +119,26 @@
   DISALLOW_COPY_AND_ASSIGN(MockTimeTickClock);
 };
 
+class MockAutomaticRebootManagerObserver
+    : public AutomaticRebootManagerObserver {
+ public:
+  MockAutomaticRebootManagerObserver();
+  ~MockAutomaticRebootManagerObserver() override;
+
+  void Init(AutomaticRebootManager* automatic_reboot_manger);
+
+  // AutomaticRebootManagerObserver:
+  MOCK_METHOD1(OnRebootRequested, void(Reason));
+  MOCK_METHOD0(WillDestroyAutomaticRebootManager, void());
+
+ private:
+  void StopObserving();
+
+  AutomaticRebootManager* automatic_reboot_manger_;
+
+  DISALLOW_COPY_AND_ASSIGN(MockAutomaticRebootManagerObserver);
+};
+
 }  // namespace
 
 class AutomaticRebootManagerBasicTest : public testing::Test {
@@ -138,13 +162,21 @@
   void FastForwardBy(const base::TimeDelta& delta, bool expect_reboot);
   void FastForwardUntilNoTasksRemain(bool expect_reboot);
 
+  void ExpectRebootRequest(AutomaticRebootManagerObserver::Reason reason);
+  void ExpectNoRebootRequest();
+
   void CreateAutomaticRebootManager(bool expect_reboot);
 
   bool ReadUpdateRebootNeededUptimeFromFile(base::TimeDelta* uptime);
+  void VerifyRebootRequested(AutomaticRebootManagerObserver::Reason reason);
+  void VerifyNoRebootRequested() const;
   void VerifyLoginScreenIdleTimerIsStopped() const;
   void VerifyNoGracePeriod() const;
   void VerifyGracePeriod(const base::TimeDelta& start_uptime) const;
 
+  // Sets the status of |update_engine_client_| to NEED_REBOOT for tests.
+  void SetUpdateStatusNeedReboot();
+
   bool is_user_logged_in_;
   bool is_logged_in_as_kiosk_app_;
 
@@ -159,15 +191,9 @@
 
   scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner_;
 
+  MockAutomaticRebootManagerObserver automatic_reboot_manager_observer_;
   scoped_ptr<AutomaticRebootManager> automatic_reboot_manager_;
 
- protected:
-  FakePowerManagerClient* power_manager_client_;  // Not owned.
-  FakeUpdateEngineClient* update_engine_client_;  // Not owned.
-
-  // Sets the status of |update_engine_client_| to NEED_REBOOT for tests.
-  void SetUpdateStatusNeedReboot();
-
  private:
   void VerifyTimerIsStopped(const Timer* timer) const;
   void VerifyTimerIsRunning(const Timer* timer,
@@ -184,6 +210,9 @@
   TestingPrefServiceSimple local_state_;
   MockUserManager* mock_user_manager_;  // Not owned.
   ScopedUserManagerEnabler user_manager_enabler_;
+
+  FakePowerManagerClient* power_manager_client_;  // Not owned.
+  FakeUpdateEngineClient* update_engine_client_;  // Not owned.
 };
 
 enum AutomaticRebootManagerTestScenario {
@@ -325,16 +354,42 @@
   return task_runner_->Now();
 }
 
+MockAutomaticRebootManagerObserver::MockAutomaticRebootManagerObserver()
+    : automatic_reboot_manger_(nullptr) {
+  ON_CALL(*this, WillDestroyAutomaticRebootManager())
+      .WillByDefault(
+          Invoke(this,
+                 &MockAutomaticRebootManagerObserver::StopObserving));
+}
+
+void MockAutomaticRebootManagerObserver::Init(
+    AutomaticRebootManager* automatic_reboot_manger) {
+  EXPECT_FALSE(automatic_reboot_manger_);
+  automatic_reboot_manger_ = automatic_reboot_manger;
+  automatic_reboot_manger_->AddObserver(this);
+}
+
+MockAutomaticRebootManagerObserver::~MockAutomaticRebootManagerObserver() {
+  if (automatic_reboot_manger_)
+    automatic_reboot_manger_->RemoveObserver(this);
+}
+
+void MockAutomaticRebootManagerObserver::StopObserving() {
+  ASSERT_TRUE(automatic_reboot_manger_);
+  automatic_reboot_manger_->RemoveObserver(this);
+  automatic_reboot_manger_ = nullptr;
+}
+
 AutomaticRebootManagerBasicTest::AutomaticRebootManagerBasicTest()
     : is_user_logged_in_(false),
       is_logged_in_as_kiosk_app_(false),
       task_runner_(new MockTimeSingleThreadTaskRunner),
-      power_manager_client_(NULL),
-      update_engine_client_(NULL),
       reboot_after_update_(false),
       ui_thread_task_runner_handle_(task_runner_),
       mock_user_manager_(new MockUserManager),
-      user_manager_enabler_(mock_user_manager_) {
+      user_manager_enabler_(mock_user_manager_),
+      power_manager_client_(NULL),
+      update_engine_client_(NULL) {
 }
 
 AutomaticRebootManagerBasicTest::~AutomaticRebootManagerBasicTest() {
@@ -372,10 +427,17 @@
 }
 
 void AutomaticRebootManagerBasicTest::TearDown() {
-  // Let the AutomaticRebootManager, if any, unregister itself as an observer of
-  // several subsystems.
-  automatic_reboot_manager_.reset();
-  task_runner_->RunUntilIdle();
+  if (automatic_reboot_manager_) {
+    Mock::VerifyAndClearExpectations(&automatic_reboot_manager_observer_);
+    EXPECT_CALL(automatic_reboot_manager_observer_,
+                WillDestroyAutomaticRebootManager()).Times(1);
+    EXPECT_CALL(automatic_reboot_manager_observer_,
+                OnRebootRequested(_)).Times(0);
+    // Let the AutomaticRebootManager, if any, unregister itself as an observer
+    // of several subsystems.
+    automatic_reboot_manager_.reset();
+    task_runner_->RunUntilIdle();
+  }
 
   DBusThreadManager::Shutdown();
   TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
@@ -387,7 +449,6 @@
   SaveUptimeToFile(update_reboot_needed_uptime_file_, uptime);
 }
 
-
 void AutomaticRebootManagerBasicTest::SetRebootAfterUpdate(
     bool reboot_after_update,
     bool expect_reboot) {
@@ -455,10 +516,30 @@
             power_manager_client_->num_request_restart_calls());
 }
 
+void AutomaticRebootManagerBasicTest::ExpectRebootRequest(
+    AutomaticRebootManagerObserver::Reason reason) {
+  Mock::VerifyAndClearExpectations(&automatic_reboot_manager_observer_);
+  EXPECT_CALL(automatic_reboot_manager_observer_,
+              WillDestroyAutomaticRebootManager()).Times(0);
+  EXPECT_CALL(automatic_reboot_manager_observer_,
+              OnRebootRequested(_)).Times(0);
+  EXPECT_CALL(automatic_reboot_manager_observer_,
+              OnRebootRequested(reason)).Times(1);
+}
+
+void AutomaticRebootManagerBasicTest::ExpectNoRebootRequest() {
+  Mock::VerifyAndClearExpectations(&automatic_reboot_manager_observer_);
+  EXPECT_CALL(automatic_reboot_manager_observer_,
+              WillDestroyAutomaticRebootManager()).Times(0);
+  EXPECT_CALL(automatic_reboot_manager_observer_,
+              OnRebootRequested(_)).Times(0);
+}
+
 void AutomaticRebootManagerBasicTest::CreateAutomaticRebootManager(
     bool expect_reboot) {
   automatic_reboot_manager_.reset(new AutomaticRebootManager(
       scoped_ptr<base::TickClock>(new MockTimeTickClock(task_runner_))));
+  automatic_reboot_manager_observer_.Init(automatic_reboot_manager_.get());
   task_runner_->RunUntilIdle();
   EXPECT_EQ(expect_reboot ? 1 : 0,
             power_manager_client_->num_request_restart_calls());
@@ -490,6 +571,16 @@
   return true;
 }
 
+void AutomaticRebootManagerBasicTest::VerifyRebootRequested(
+    AutomaticRebootManagerObserver::Reason reason) {
+  EXPECT_TRUE(automatic_reboot_manager_->reboot_requested());
+  EXPECT_EQ(reason, automatic_reboot_manager_->reboot_reason());
+}
+
+void AutomaticRebootManagerBasicTest::VerifyNoRebootRequested() const {
+  EXPECT_FALSE(automatic_reboot_manager_->reboot_requested());
+}
+
 void AutomaticRebootManagerBasicTest::
     VerifyLoginScreenIdleTimerIsStopped() const {
   VerifyTimerIsStopped(
@@ -521,6 +612,12 @@
   }
 }
 
+void AutomaticRebootManagerBasicTest::SetUpdateStatusNeedReboot() {
+  UpdateEngineClient::Status client_status;
+  client_status.status = UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT;
+  update_engine_client_->set_default_status(client_status);
+}
+
 void AutomaticRebootManagerBasicTest::VerifyTimerIsStopped(
     const Timer* timer) const {
   if (timer)
@@ -543,12 +640,6 @@
       base::TimeDelta::FromSeconds(60));
 }
 
-void AutomaticRebootManagerBasicTest::SetUpdateStatusNeedReboot() {
-  UpdateEngineClient::Status client_status;
-  client_status.status = UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT;
-  update_engine_client_->set_default_status(client_status);
-}
-
 AutomaticRebootManagerTest::AutomaticRebootManagerTest() {
   switch (GetParam()) {
     case AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN:
@@ -575,9 +666,11 @@
 TEST_F(AutomaticRebootManagerBasicTest, LoginStopsIdleTimer) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately and the login screen
-  // idle timer is started.
+  // Verify that no reboot is requested, the device does not reboot immediately
+  // and the login screen idle timer is started.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Notify that a kiosk app session has been started.
   is_user_logged_in_ = true;
@@ -590,7 +683,7 @@
   // Verify that the login screen idle timer is stopped.
   VerifyLoginScreenIdleTimerIsStopped();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -600,9 +693,11 @@
 TEST_F(AutomaticRebootManagerBasicTest, NonKioskLoginStopsIdleTimer) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately and the login screen
-  // idle timer is started.
+  // Verify that no reboot is requested, the device does not reboot immediately
+  // and the login screen idle timer is started.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Notify that a non-kiosk-app session has been started.
   is_user_logged_in_ = true;
@@ -614,7 +709,7 @@
   // Verify that the login screen idle timer is stopped.
   VerifyLoginScreenIdleTimerIsStopped();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -625,11 +720,15 @@
 TEST_F(AutomaticRebootManagerBasicTest, UserActivityResetsIdleTimer) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately and the login screen
-  // idle timer is started.
+  // Verify that no reboot is requested, the device does not reboot immediately
+  // and the login screen idle timer is started.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -659,17 +758,20 @@
   is_logged_in_as_kiosk_app_ = true;
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Notify that the device has resumed from 1 hour of sleep. Verify that the
-  // device does not reboot immediately.
+  // Notify that the device has resumed from 1 hour of sleep. Verify that no
+  // reboot is requested and the device does not reboot immediately.
   NotifyResumed(false);
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -680,17 +782,20 @@
   is_user_logged_in_ = true;
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Notify that the device has resumed from 1 hour of sleep. Verify that the
-  // device does not reboot immediately.
+  // Notify that the device has resumed from 1 hour of sleep. Verify that no
+  // reboot is requested and the device does not reboot immediately.
   NotifyResumed(false);
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -703,20 +808,25 @@
   is_logged_in_as_kiosk_app_ = true;
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Notify that the device has resumed from 1 hour of sleep. Verify that the
-  // device does not reboot immediately.
+  // Notify that the device has resumed from 1 hour of sleep. Verify that no
+  // reboot is requested and the device does not reboot immediately.
   NotifyResumed(false);
 
-  // Verify that the device eventually reboots.
+  // Verify a reboot is requested and the device reboots eventually.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   FastForwardUntilNoTasksRemain(true);
 }
 
@@ -728,20 +838,25 @@
   is_user_logged_in_ = true;
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Notify that the device has resumed from 1 hour of sleep. Verify that the
-  // device does not reboot immediately.
+  // Notify that the device has resumed from 1 hour of sleep. Verify that no
+  // reboot is requested and the device does not reboot immediately.
   NotifyResumed(false);
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is requested eventually but the device never reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -754,10 +869,15 @@
   is_logged_in_as_kiosk_app_ = true;
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -776,10 +896,15 @@
   is_user_logged_in_ = true;
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -789,7 +914,7 @@
   // device does not reboot immediately.
   NotifyResumed(false);
 
-  // Verify that the device does not reboot eventually.
+  // Verify that the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -803,10 +928,15 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(29) +
                           base::TimeDelta::FromMinutes(30));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -826,10 +956,15 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(29) +
                           base::TimeDelta::FromMinutes(30));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -839,7 +974,7 @@
   // device does not reboot immediately.
   NotifyResumed(false);
 
-  // Verify that the device does not reboot eventually.
+  // Verify that the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -849,17 +984,20 @@
 TEST_P(AutomaticRebootManagerTest, TerminateNoPolicy) {
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Notify that the browser is terminating. Verify that the device does not
-  // reboot immediately.
+  // Notify that the browser is terminating. Verify that no reboot is requested
+  // and the device does not reboot immediately.
   NotifyTerminating(false);
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -869,21 +1007,26 @@
 TEST_P(AutomaticRebootManagerTest, TerminateBeforeGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Notify that the browser is terminating. Verify that the device does not
-  // reboot immediately.
+  // Notify that the browser is terminating. Verify that no reboot is requested
+  // and the device does not reboot immediately.
   NotifyTerminating(false);
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // eventually reboots.
+  // Verify that a reboot is requested eventually and unless a non-kiosk-app
+  // session is in progress, the device eventually reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -895,10 +1038,15 @@
 TEST_P(AutomaticRebootManagerTest, TerminateInGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -908,8 +1056,8 @@
   // reboots if a kiosk app session is in progress.
   NotifyTerminating(is_logged_in_as_kiosk_app_);
 
-  // Verify that if a non-kiosk-app session is in progress, the device does not
-  // reboot eventually.
+  // Verify that if a non-kiosk-app session is in progress, the device never
+  // reboots.
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -920,20 +1068,25 @@
 TEST_P(AutomaticRebootManagerTest, BeforeUptimeLimitGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // eventually reboots.
+  // Verify that a reboot is requested eventually and unless a non-kiosk-app
+  // session is in progress, the device eventually reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -944,13 +1097,18 @@
 TEST_P(AutomaticRebootManagerTest, InUptimeLimitGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -969,19 +1127,23 @@
 TEST_P(AutomaticRebootManagerTest, AfterUptimeLimitGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Set the uptime limit. Verify that unless a non-kiosk-app session is in
-  // progress, the the device immediately reboots.
+  // Set the uptime limit. Verify that a reboot is requested and unless a
+  // non-kiosk-app session is in progress, the the device immediately reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), !is_user_logged_in_ ||
                                                 is_logged_in_as_kiosk_app_);
 
-  // Verify that if a non-kiosk-app session is in progress, the device does not
-  // reboot eventually.
+  // Verify that if a non-kiosk-app session is in progress, the device never
+  // reboots.
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -992,27 +1154,31 @@
 TEST_P(AutomaticRebootManagerTest, UptimeLimitOffBeforeGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(6));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(12), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Fast forward the uptime by 1 hour. Verify that the device does not reboot
-  // immediately.
+  // Fast forward the uptime by 1 hour. Verify that no reboot is requested and
+  // the device does not reboot immediately.
   FastForwardBy(base::TimeDelta::FromHours(1), false);
 
-  // Remove the uptime limit. Verify that the device does not reboot
-  // immediately.
+  // Remove the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta(), false);
 
   // Verify that the grace period has been removed.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1022,10 +1188,15 @@
 TEST_P(AutomaticRebootManagerTest, UptimeLimitOffInGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(24));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(12), false);
 
   // Verify that a grace period has started.
@@ -1042,7 +1213,7 @@
   // Verify that the grace period has been removed.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1053,29 +1224,34 @@
 TEST_P(AutomaticRebootManagerTest, ExtendUptimeLimitBeforeGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(6));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(12), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Fast forward the uptime by 20 seconds. Verify that the device does not
-  // reboot immediately.
+  // Fast forward the uptime by 20 seconds. Verify that no reboot is requested
+  // and the device does not reboot immediately.
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
-  // Extend the uptime limit. Verify that the device does not reboot
-  // immediately.
+  // Extend the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that the grace period has been rescheduled to start further in the
   // future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // eventually reboots.
+  // Verify that a reboot is requested eventually and unless a non-kiosk-app
+  // session is in progress, the device eventually reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1087,10 +1263,15 @@
 TEST_P(AutomaticRebootManagerTest, ExtendUptimeLimitInGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(18));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(12), false);
 
   // Verify that a grace period has started.
@@ -1107,8 +1288,9 @@
   // Verify that the grace period has been rescheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // eventually reboots.
+  // Verify that a reboot is requested again eventually and unless a
+  // non-kiosk-app session is in progress, the device eventually reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1120,21 +1302,26 @@
 TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitBeforeToInGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(18), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Fast forward the uptime by 20 seconds. Verify that the device does not
-  // reboot immediately.
+  // Fast forward the uptime by 20 seconds. Verify that no reboot is requested
+  // and the device does not reboot immediately.
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
-  // Shorten the uptime limit. Verify that the device does not reboot
-  // immediately.
+  // Shorten the uptime limit. Verify that a reboot is requested but the device
+  // does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that the grace period has been rescheduled and has started already.
@@ -1153,10 +1340,15 @@
 TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitInToInGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(36));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that a grace period has started.
@@ -1166,8 +1358,9 @@
   // reboot immediately.
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
-  // Shorten the uptime limit. Verify that the device does not reboot
-  // immediately.
+  // Shorten the uptime limit. Verify that a reboot is requested again but the
+  // device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(18), false);
 
   // Verify that the grace period has been rescheduled to have started earlier.
@@ -1187,10 +1380,15 @@
 TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitInToAfterGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(36));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that a grace period has started.
@@ -1200,13 +1398,15 @@
   // reboot immediately.
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
-  // Shorten the uptime limit. Verify that unless a non-kiosk-app session is in
-  // progress, the the device immediately reboots.
+  // Shorten the uptime limit. Verify that a reboot is requested again and
+  // unless a non-kiosk-app session is in progress, the the device immediately
+  // reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), !is_user_logged_in_ ||
                                                 is_logged_in_as_kiosk_app_);
 
-  // Verify that if a non-kiosk-app session is in progress, the device does not
-  // reboot eventually.
+  // Verify that if a non-kiosk-app session is in progress, the device never
+  // reboots.
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1219,14 +1419,17 @@
 TEST_P(AutomaticRebootManagerTest, UpdateNoPolicy) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that no reboot is requested and the device does not reboot immediately.
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1238,7 +1441,7 @@
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1251,14 +1454,18 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that a reboot is requested but the device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1278,20 +1485,24 @@
 
 // Chrome is running. The current uptime is 12 hours.
 // Verifies that when Chrome is notified twice that an update has been applied,
-// the second notification is ignored and the uptime at which it occured does
+// the second notification is ignored and the uptime at which it occurred does
 // not get persisted as the time at which an update became necessary.
 TEST_P(AutomaticRebootManagerTest, UpdateAfterUpdate) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that a reboot is requested but the device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1326,7 +1537,7 @@
 
 // Chrome is running. The current uptime is 10 minutes.
 // Verifies that when the policy to automatically reboot after an update is
-// enabled, no reboot occurs a grace period is scheduled to begin after the
+// enabled, no reboot occurs and a grace period is scheduled to begin after the
 // minimum of 1 hour of uptime. Further verifies that when an update is applied,
 // the current uptime is persisted as the time at which a reboot became
 // necessary.
@@ -1334,14 +1545,17 @@
   task_runner_->SetUptime(base::TimeDelta::FromMinutes(10));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that no reboot is requested and the device does not reboot immediately.
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1353,8 +1567,9 @@
   // Verify that a grace period has been scheduled to begin in the future.
   VerifyGracePeriod(base::TimeDelta::FromHours(1));
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // eventually reboots.
+  // Verify that a reboot is requested eventually and unless a non-kiosk-app
+  // session is in progress, the device eventually reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1368,22 +1583,26 @@
 TEST_P(AutomaticRebootManagerTest, PolicyAfterUpdateInGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(6));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that no reboot is requested and the device does not reboot immediately.
   NotifyUpdateRebootNeeded();
 
-  // Fast forward the uptime to 12 hours. Verify that the device does not reboot
-  // immediately.
+  // Fast forward the uptime to 12 hours. Verify that no reboot is requested and
+  // the device does not reboot immediately.
   FastForwardBy(base::TimeDelta::FromHours(6), false);
 
   // Simulate user activity.
   automatic_reboot_manager_->OnUserActivity(NULL);
 
-  // Enable automatic reboot after an update has been applied. Verify that the
-  // device does not reboot immediately.
+  // Enable automatic reboot after an update has been applied. Verify that a
+  // reboot is requested but the device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   SetRebootAfterUpdate(true, false);
 
   // Verify that a grace period has started.
@@ -1404,15 +1623,18 @@
 TEST_P(AutomaticRebootManagerTest, PolicyAfterUpdateAfterGracePeriod) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(6));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that no reboot is requested and the device does not reboot immediately.
   NotifyUpdateRebootNeeded();
 
-  // Fast forward the uptime to 12 hours. Verify that the device does not reboot
-  // immediately.
+  // Fast forward the uptime to 12 hours. Verify that no reboot is requested and
+  // the device does not reboot immediately.
   FastForwardBy(base::TimeDelta::FromDays(10) - base::TimeDelta::FromHours(6),
                 false);
 
@@ -1420,12 +1642,13 @@
   automatic_reboot_manager_->OnUserActivity(NULL);
 
   // Enable automatic rebooting after an update has been applied. Verify that
-  // unless a non-kiosk-app session is in progress, the the device immediately
-  // reboots.
+  // a reboot is requested and unless a non-kiosk-app session is in progress,
+  // the the device immediately reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   SetRebootAfterUpdate(true, !is_user_logged_in_ || is_logged_in_as_kiosk_app_);
 
-  // Verify that if a non-kiosk-app session is in progress, the device does not
-  // reboot eventually.
+  // Verify that if a non-kiosk-app session is in progress, the device never
+  // reboots.
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1440,11 +1663,15 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(6));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that a reboot is requested but the device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   NotifyUpdateRebootNeeded();
 
   // Verify that a grace period has started.
@@ -1455,13 +1682,13 @@
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
   // Disable automatic rebooting after an update has been applied. Verify that
-  // the device does not reboot immediately.
+  // no reboot is requested and the device does not reboot immediately.
   SetRebootAfterUpdate(false, false);
 
   // Verify that the grace period has been removed.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1471,24 +1698,28 @@
 // occurs and no grace period is scheduled. Further verifies that no time is
 // persisted as the time at which a reboot became necessary.
 TEST_P(AutomaticRebootManagerTest, NoUptime) {
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
   // Enable automatic rebooting after an update has been applied. Verify that
-  // the device does not reboot immediately.
+  // no reboot is requested and the device does not reboot immediately.
   SetRebootAfterUpdate(true, false);
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that no reboot is requested and the device does not reboot immediately.
   NotifyUpdateRebootNeeded();
 
   // Verify that no time is persisted as the time at which a reboot became
@@ -1499,7 +1730,7 @@
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1513,10 +1744,15 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has been scheduled to start in the future.
@@ -1527,7 +1763,9 @@
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that a reboot is requested again but the device does not reboot
+  // immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1555,21 +1793,26 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Fast forward the uptime by 20 seconds. Verify that the device does not
-  // reboot immediately.
+  // Fast forward the uptime by 20 seconds. Verify that no reboot is requested
+  // and the device does not reboot immediately.
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that a reboot is requested but the device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1593,23 +1836,28 @@
 // The policy to automatically reboot after an update is enabled. The current
 // uptime is 12 hours 20 seconds.
 // Verifies that when the policy to reboot after an update is disabled, the
-// grace period is rescheduled to start after 24 hours of uptime. Further
+// grace period is rescheduled to start after 12 hours of uptime. Further
 // verifies that when the uptime limit is removed, the grace period is removed.
 TEST_P(AutomaticRebootManagerTest, PolicyOffThenUptimeLimitOff) {
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that no reboot is requested and the device
+  // does not reboot immediately.
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
 
-  // Verify that the grace period has started.
+  // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that a reboot is requested but the device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1640,7 +1888,7 @@
   // Verify that the grace period has been removed.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1656,11 +1904,15 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Notify that an update has been applied and a reboot is necessary. Verify
-  // that the device does not reboot immediately.
+  // that a reboot is requested but the device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   NotifyUpdateRebootNeeded();
 
   // Verify that the current uptime has been persisted as the time at which a
@@ -1672,7 +1924,9 @@
   // Verify that the grace period has started.
   VerifyGracePeriod(update_reboot_needed_uptime_ + uptime_processing_delay_);
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested again but the
+  // device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that the grace period has been rescheduled to have started after
@@ -1683,8 +1937,9 @@
   // reboot immediately.
   FastForwardBy(base::TimeDelta::FromSeconds(20), false);
 
-  // Remove the uptime limit. Verify that the device does not reboot
-  // immediately.
+  // Remove the uptime limit. Verify that a reboot is requested again but the
+  // device does not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   SetUptimeLimit(base::TimeDelta(), false);
 
   // Verify that a grace period has been rescheduled to have started after 12
@@ -1698,7 +1953,7 @@
   // Verify that the grace period has been removed.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1711,10 +1966,15 @@
                           base::TimeDelta::FromMinutes(59) +
                           base::TimeDelta::FromSeconds(59));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
-  // Set the uptime limit. Verify that the device does not reboot immediately.
+  // Set the uptime limit. Verify that a reboot is requested but the device does
+  // not reboot immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
 
   // Verify that a grace period has started.
@@ -1725,8 +1985,8 @@
   FastForwardBy(base::TimeDelta::FromSeconds(1), !is_user_logged_in_ ||
                                                  is_logged_in_as_kiosk_app_);
 
-  // Verify that if a non-kiosk-app session is in progress, the device does not
-  // reboot eventually.
+  // Verify that if a non-kiosk-app session is in progress, the device never
+  // reboots.
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1737,13 +1997,16 @@
 TEST_P(AutomaticRebootManagerTest, StartNoPolicy) {
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1755,14 +2018,18 @@
   SetUptimeLimit(base::TimeDelta::FromHours(24), false);
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(uptime_limit_);
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // eventually reboots.
+  // Verify that a reboot is requested eventually and unless a non-kiosk-app
+  // session is in progress, the device eventually reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1775,13 +2042,15 @@
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that unless a non-kiosk-app session is in progress, the the device
-  // immediately reboots.
+  // Verify that a reboot is requested and unless a non-kiosk-app session is in
+  // progress, the the device immediately reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   CreateAutomaticRebootManager(!is_user_logged_in_ ||
                                is_logged_in_as_kiosk_app_);
+  VerifyRebootRequested(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
 
-  // Verify that if a non-kiosk-app session is in progress, the device does not
-  // reboot eventually.
+  // Verify that if a non-kiosk-app session is in progress, the device never
+  // reboots.
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1794,8 +2063,11 @@
   SetUptimeLimit(base::TimeDelta::FromHours(6), false);
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that a reboot is requested but the device does not reboot
+  // immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   CreateAutomaticRebootManager(false);
+  VerifyRebootRequested(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
 
   // Verify that a grace period has started.
   VerifyGracePeriod(uptime_limit_);
@@ -1818,13 +2090,16 @@
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // reboots immediately.
+  // Verify that a reboot is requested and unless a non-kiosk-app session is in
+  // progress, the the device immediately reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   CreateAutomaticRebootManager(!is_user_logged_in_ ||
                                is_logged_in_as_kiosk_app_);
+  VerifyRebootRequested(
+      AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
 
-  // Verify that if a non-kiosk-app session is in progress, the device does not
-  // reboot eventually.
+  // Verify that if a non-kiosk-app session is in progress, the device never
+  // reboots.
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1841,8 +2116,12 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that a reboot is requested but the device does not reboot
+  // immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   CreateAutomaticRebootManager(false);
+  VerifyRebootRequested(
+      AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
 
   // Verify that a grace period has started.
   VerifyGracePeriod(update_reboot_needed_uptime_);
@@ -1865,14 +2144,18 @@
   task_runner_->SetUptime(base::TimeDelta::FromMinutes(20));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that a grace period has been scheduled to start in the future.
   VerifyGracePeriod(base::TimeDelta::FromHours(1));
 
-  // Verify that unless a non-kiosk-app session is in progress, the device
-  // eventually reboots.
+  // Verify that a reboot is requested eventually and unless a non-kiosk-app
+  // session is in progress, the device eventually reboots.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   FastForwardUntilNoTasksRemain(!is_user_logged_in_ ||
                                 is_logged_in_as_kiosk_app_);
 }
@@ -1887,13 +2170,16 @@
   SetUpdateRebootNeededUptime(base::TimeDelta::FromHours(6));
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1909,8 +2195,12 @@
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that a reboot is requested but the device does not reboot
+  // immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   CreateAutomaticRebootManager(false);
+  VerifyRebootRequested(
+      AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
 
   // Verify that the current uptime has been persisted as the time at which a
   // reboot became necessary.
@@ -1938,8 +2228,11 @@
   SetUpdateStatusNeedReboot();
   task_runner_->SetUptime(base::TimeDelta::FromDays(10));
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that the current uptime has been persisted as the time at which a
   // reboot became necessary.
@@ -1950,7 +2243,7 @@
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1963,8 +2256,11 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no time is persisted as the time at which a reboot became
   // necessary.
@@ -1974,7 +2270,7 @@
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
@@ -1991,8 +2287,11 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that a reboot is requested but the device does not reboot
+  // immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
   CreateAutomaticRebootManager(false);
+  VerifyRebootRequested(AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC);
 
   // Verify that a grace period has started.
   VerifyGracePeriod(uptime_limit_);
@@ -2016,8 +2315,12 @@
   task_runner_->SetUptime(base::TimeDelta::FromHours(12));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that a reboot is requested but the device does not reboot
+  // immediately.
+  ExpectRebootRequest(AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
   CreateAutomaticRebootManager(false);
+  VerifyRebootRequested(
+      AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE);
 
   // Verify that a grace period has started.
   VerifyGracePeriod(update_reboot_needed_uptime_);
@@ -2039,13 +2342,16 @@
   SetUpdateRebootNeededUptime(base::TimeDelta::FromHours(6));
   SetRebootAfterUpdate(true, false);
 
-  // Verify that the device does not reboot immediately.
+  // Verify that no reboot is requested and the device does not reboot
+  // immediately.
+  ExpectNoRebootRequest();
   CreateAutomaticRebootManager(false);
+  VerifyNoRebootRequested();
 
   // Verify that no grace period has started.
   VerifyNoGracePeriod();
 
-  // Verify that the device does not reboot eventually.
+  // Verify that a reboot is never requested and the device never reboots.
   FastForwardUntilNoTasksRemain(false);
 }
 
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json
index 112378d..139baba 100644
--- a/chrome/common/extensions/api/_permission_features.json
+++ b/chrome/common/extensions/api/_permission_features.json
@@ -624,7 +624,7 @@
     ]
   },
   "webcamPrivate": {
-    "channel": "dev",
+    "channel": "stable",
     "extension_types": ["extension", "platform_app"]
   },
   "management": [
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index cb3e47e..a1ea36b 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -792,7 +792,16 @@
 
 void CrasAudioHandler::UpdateDevicesAndSwitchActive(
     const AudioNodeList& nodes) {
-  size_t old_audio_devices_size = audio_devices_.size();
+  size_t old_output_device_size = 0;
+  size_t old_input_device_size = 0;
+  for (AudioDeviceMap::const_iterator it = audio_devices_.begin();
+       it != audio_devices_.end(); ++it) {
+    if (it->second.is_input)
+      ++old_input_device_size;
+    else
+      ++old_output_device_size;
+  }
+
   bool output_devices_changed = HasDeviceChange(nodes, false);
   bool input_devices_changed = HasDeviceChange(nodes, true);
   audio_devices_.clear();
@@ -804,6 +813,8 @@
   while (!output_devices_pq_.empty())
     output_devices_pq_.pop();
 
+  size_t new_output_device_size = 0;
+  size_t new_input_device_size = 0;
   for (size_t i = 0; i < nodes.size(); ++i) {
     AudioDevice device(nodes[i]);
     audio_devices_[device.id] = device;
@@ -819,24 +830,27 @@
       has_alternative_output_ = true;
     }
 
-    if (device.is_input)
+    if (device.is_input) {
       input_devices_pq_.push(device);
-    else
+      ++new_input_device_size;
+    } else {
       output_devices_pq_.push(device);
+      ++new_output_device_size;
+    }
   }
 
   // If audio nodes change is caused by unplugging some non-active audio
   // devices, the previously set active audio device will stay active.
   // Otherwise, switch to a new active audio device according to their priority.
   if (input_devices_changed &&
-      !NonActiveDeviceUnplugged(old_audio_devices_size,
-                                audio_devices_.size(),
+      !NonActiveDeviceUnplugged(old_input_device_size,
+                                new_input_device_size,
                                 active_input_node_id_) &&
       !input_devices_pq_.empty())
     SwitchToDevice(input_devices_pq_.top(), true);
   if (output_devices_changed &&
-      !NonActiveDeviceUnplugged(old_audio_devices_size,
-                                audio_devices_.size(),
+      !NonActiveDeviceUnplugged(old_output_device_size,
+                                new_output_device_size,
                                 active_output_node_id_) &&
       !output_devices_pq_.empty()) {
     SwitchToDevice(output_devices_pq_.top(), true);
diff --git a/chromeos/audio/cras_audio_handler_unittest.cc b/chromeos/audio/cras_audio_handler_unittest.cc
index ea0b6a7..23ed16f 100644
--- a/chromeos/audio/cras_audio_handler_unittest.cc
+++ b/chromeos/audio/cras_audio_handler_unittest.cc
@@ -412,7 +412,6 @@
   EXPECT_TRUE(cras_audio_handler_->has_alternative_output());
 
   // Ensure the USB microphone has been selected as the active input.
-  AudioDevice active_input;
   EXPECT_EQ(kUSBMicId, cras_audio_handler_->GetPrimaryActiveInputNode());
   EXPECT_TRUE(cras_audio_handler_->has_alternative_input());
 }
@@ -1686,6 +1685,87 @@
   }
 }
 
+// This is the case of crbug.com/448924.
+TEST_F(CrasAudioHandlerTest,
+       TwoNodesChangedSignalsForLosingTowNodesOnOneUnplug) {
+  // Set up audio handler with 4 audio_nodes.
+  AudioNodeList audio_nodes;
+  AudioNode internal_speaker(kInternalSpeaker);
+  internal_speaker.active = false;
+  AudioNode headphone(kHeadphone);
+  headphone.active = false;
+  AudioNode internal_mic(kInternalMic);
+  internal_mic.active = false;
+  AudioNode micJack(kMicJack);
+  micJack.active = false;
+  audio_nodes.push_back(internal_speaker);
+  audio_nodes.push_back(headphone);
+  audio_nodes.push_back(internal_mic);
+  audio_nodes.push_back(micJack);
+  SetUpCrasAudioHandler(audio_nodes);
+
+  // Verify the audio devices size.
+  AudioDeviceList audio_devices;
+  cras_audio_handler_->GetAudioDevices(&audio_devices);
+  EXPECT_EQ(audio_nodes.size(), audio_devices.size());
+
+  // Verify the headphone has been selected as the active output.
+  AudioDevice active_output;
+  EXPECT_TRUE(
+      cras_audio_handler_->GetPrimaryActiveOutputDevice(&active_output));
+  EXPECT_EQ(kHeadphone.id, active_output.id);
+  EXPECT_EQ(kHeadphone.id, cras_audio_handler_->GetPrimaryActiveOutputNode());
+  EXPECT_TRUE(active_output.active);
+  EXPECT_TRUE(cras_audio_handler_->has_alternative_output());
+
+  // Verify the mic Jack has been selected as the active input.
+  EXPECT_EQ(micJack.id, cras_audio_handler_->GetPrimaryActiveInputNode());
+  const AudioDevice* active_input = GetDeviceFromId(micJack.id);
+  EXPECT_TRUE(active_input->active);
+  EXPECT_TRUE(cras_audio_handler_->has_alternative_input());
+
+  // Simulate the nodes list in first NodesChanged signal, only headphone is
+  // removed, other nodes remains the same.
+  AudioNodeList changed_nodes_1;
+  internal_speaker.active = false;
+  changed_nodes_1.push_back(internal_speaker);
+  internal_mic.active = false;
+  changed_nodes_1.push_back(internal_mic);
+  micJack.active = true;
+  changed_nodes_1.push_back(micJack);
+
+  // Simulate the nodes list in second NodesChanged signal, the micJac is
+  // removed, but the internal_mic is inactive, which does not reflect the
+  // active status set from the first NodesChanged signal since this was sent
+  // before cras receives the SetActiveOutputNode from the first NodesChanged
+  // handling.
+  AudioNodeList changed_nodes_2;
+  changed_nodes_2.push_back(internal_speaker);
+  changed_nodes_2.push_back(internal_mic);
+
+  // Simulate AudioNodesChanged signal being fired twice for unplug an audio
+  // device with both input and output nodes on it.
+  ChangeAudioNodes(changed_nodes_1);
+  ChangeAudioNodes(changed_nodes_2);
+
+  AudioDeviceList changed_devices;
+  cras_audio_handler_->GetAudioDevices(&changed_devices);
+  EXPECT_EQ(2u, changed_devices.size());
+
+  // Verify the active output device is set to internal speaker.
+  EXPECT_EQ(internal_speaker.id,
+            cras_audio_handler_->GetPrimaryActiveOutputNode());
+  EXPECT_TRUE(
+      cras_audio_handler_->GetPrimaryActiveOutputDevice(&active_output));
+  EXPECT_EQ(internal_speaker.id, active_output.id);
+  EXPECT_TRUE(active_output.active);
+
+  // Verify the active input device id is set to internal mic.
+  EXPECT_EQ(internal_mic.id, cras_audio_handler_->GetPrimaryActiveInputNode());
+  const AudioDevice* changed_active_input = GetDeviceFromId(internal_mic.id);
+  EXPECT_TRUE(changed_active_input->active);
+}
+
 TEST_F(CrasAudioHandlerTest, SetOutputMute) {
   AudioNodeList audio_nodes;
   audio_nodes.push_back(kInternalSpeaker);
diff --git a/components/data_reduction_proxy_version_header.target.darwin-arm.mk b/components/data_reduction_proxy_version_header.target.darwin-arm.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.darwin-arm.mk
+++ b/components/data_reduction_proxy_version_header.target.darwin-arm.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.darwin-arm64.mk b/components/data_reduction_proxy_version_header.target.darwin-arm64.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.darwin-arm64.mk
+++ b/components/data_reduction_proxy_version_header.target.darwin-arm64.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.darwin-mips.mk b/components/data_reduction_proxy_version_header.target.darwin-mips.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.darwin-mips.mk
+++ b/components/data_reduction_proxy_version_header.target.darwin-mips.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.darwin-mips64.mk b/components/data_reduction_proxy_version_header.target.darwin-mips64.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.darwin-mips64.mk
+++ b/components/data_reduction_proxy_version_header.target.darwin-mips64.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.darwin-x86.mk b/components/data_reduction_proxy_version_header.target.darwin-x86.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.darwin-x86.mk
+++ b/components/data_reduction_proxy_version_header.target.darwin-x86.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.darwin-x86_64.mk b/components/data_reduction_proxy_version_header.target.darwin-x86_64.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.darwin-x86_64.mk
+++ b/components/data_reduction_proxy_version_header.target.darwin-x86_64.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.linux-arm.mk b/components/data_reduction_proxy_version_header.target.linux-arm.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.linux-arm.mk
+++ b/components/data_reduction_proxy_version_header.target.linux-arm.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.linux-arm64.mk b/components/data_reduction_proxy_version_header.target.linux-arm64.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.linux-arm64.mk
+++ b/components/data_reduction_proxy_version_header.target.linux-arm64.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.linux-mips.mk b/components/data_reduction_proxy_version_header.target.linux-mips.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.linux-mips.mk
+++ b/components/data_reduction_proxy_version_header.target.linux-mips.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.linux-mips64.mk b/components/data_reduction_proxy_version_header.target.linux-mips64.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.linux-mips64.mk
+++ b/components/data_reduction_proxy_version_header.target.linux-mips64.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.linux-x86.mk b/components/data_reduction_proxy_version_header.target.linux-x86.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.linux-x86.mk
+++ b/components/data_reduction_proxy_version_header.target.linux-x86.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/components/data_reduction_proxy_version_header.target.linux-x86_64.mk b/components/data_reduction_proxy_version_header.target.linux-x86_64.mk
index 908c52f..ec8a749 100644
--- a/components/data_reduction_proxy_version_header.target.linux-x86_64.mk
+++ b/components/data_reduction_proxy_version_header.target.linux-x86_64.mk
@@ -22,7 +22,7 @@
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h: $(LOCAL_PATH)/chrome/VERSION $(LOCAL_PATH)/components/data_reduction_proxy/core/common/version.h.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating version header file: "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h" ($@)"
-	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.87\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
+	$(hide)cd $(gyp_local_path)/components; mkdir -p $(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common; python ../build/util/version.py -e "VERSION_FULL=\"40.0.2214.89\"" data_reduction_proxy/core/common/version.h.in "$(gyp_shared_intermediate_dir)/components/data_reduction_proxy/core/common/version.h"
 
 
 
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
index 3e9fc9b..d28d22b 100644
--- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
+++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -788,7 +788,8 @@
   RunTest(FILE_PATH_LITERAL("input-color.html"));
 }
 
-IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputDate) {
+IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
+    DISABLED_AccessibilityInputDate) {
   RunTest(FILE_PATH_LITERAL("input-date.html"));
 }
 
@@ -861,7 +862,8 @@
   RunTest(FILE_PATH_LITERAL("input-text-value.html"));
 }
 
-IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputTime) {
+IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
+    DISABLED_AccessibilityInputTime) {
   RunTest(FILE_PATH_LITERAL("input-time.html"));
 }