Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / file_manager / file_manager_browsertest.cc
index f6ddfbc..2a0357e 100644 (file)
 #include "base/strings/string_piece.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
+#include "chrome/browser/browser_process.h"
 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
 #include "chrome/browser/chromeos/drive/file_system_interface.h"
+#include "chrome/browser/chromeos/drive/test_util.h"
 #include "chrome/browser/chromeos/file_manager/app_id.h"
 #include "chrome/browser/chromeos/file_manager/drive_test_util.h"
 #include "chrome/browser/chromeos/file_manager/path_util.h"
@@ -31,6 +33,8 @@
 #include "chrome/browser/drive/fake_drive_service.h"
 #include "chrome/browser/extensions/component_loader.h"
 #include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/notifications/notification.h"
+#include "chrome/browser/notifications/notification_ui_manager.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
@@ -277,7 +281,7 @@ class DownloadsTestVolume : public LocalTestVolume {
   DownloadsTestVolume() : LocalTestVolume("Downloads") {}
   virtual ~DownloadsTestVolume() {}
 
-  virtual bool Mount(Profile* profile) OVERRIDE {
+  virtual bool Mount(Profile* profile) override {
     return CreateRootDirectory(profile) &&
            VolumeManager::Get(profile)
                ->RegisterDownloadsDirectoryForTesting(root_path());
@@ -309,7 +313,7 @@ class FakeTestVolume : public LocalTestVolume {
     return true;
   }
 
-  virtual bool Mount(Profile* profile) OVERRIDE {
+  virtual bool Mount(Profile* profile) override {
     if (!CreateRootDirectory(profile))
       return false;
     storage::ExternalMountPoints* const mount_points =
@@ -505,7 +509,7 @@ class FileManagerTestListener : public content::NotificationObserver {
 
   virtual void Observe(int type,
                        const content::NotificationSource& source,
-                       const content::NotificationDetails& details) OVERRIDE {
+                       const content::NotificationDetails& details) override {
     Message entry;
     entry.type = type;
     entry.message = type != extensions::NOTIFICATION_EXTENSION_TEST_PASSED
@@ -527,12 +531,12 @@ class FileManagerTestListener : public content::NotificationObserver {
 // The base test class.
 class FileManagerBrowserTestBase : public ExtensionApiTest {
  protected:
-  virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
+  virtual void SetUpInProcessBrowserTestFixture() override;
 
-  virtual void SetUpOnMainThread() OVERRIDE;
+  virtual void SetUpOnMainThread() override;
 
   // Adds an incognito and guest-mode flags for tests in the guest mode.
-  virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
+  virtual void SetUpCommandLine(CommandLine* command_line) override;
 
   // Loads our testing extension and sends it a string identifying the current
   // test.
@@ -545,8 +549,9 @@ class FileManagerBrowserTestBase : public ExtensionApiTest {
   }
   virtual GuestMode GetGuestModeParam() const = 0;
   virtual const char* GetTestCaseNameParam() const = 0;
-  virtual std::string OnMessage(const std::string& name,
-                                const base::Value* value);
+  virtual void OnMessage(const std::string& name,
+                         const base::DictionaryValue& value,
+                         std::string* output);
 
   scoped_ptr<LocalTestVolume> local_volume_;
   linked_ptr<DriveTestVolume> drive_volume_;
@@ -591,6 +596,8 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
     drive_volume_->ConfigureShareUrlBase(share_url_base);
     test_util::WaitUntilDriveMountPointIsAdded(profile());
   }
+
+  net::NetworkChangeNotifier::SetTestNotificationsOnly(true);
 }
 
 void FileManagerBrowserTestBase::SetUpCommandLine(CommandLine* command_line) {
@@ -642,16 +649,25 @@ void FileManagerBrowserTestBase::RunTestMessageLoop() {
         !message_dictionary->GetString("name", &name))
       continue;
 
-    entry.function->Reply(OnMessage(name, value.get()));
+    std::string output;
+    OnMessage(name, *message_dictionary, &output);
+    if (HasFatalFailure())
+      break;
+
+    entry.function->Reply(output);
   }
 }
 
-std::string FileManagerBrowserTestBase::OnMessage(const std::string& name,
-                                                  const base::Value* value) {
+void FileManagerBrowserTestBase::OnMessage(const std::string& name,
+                                           const base::DictionaryValue& value,
+                                           std::string* output) {
   if (name == "getTestName") {
     // Pass the test case name.
-    return GetTestCaseNameParam();
-  } else if (name == "getRootPaths") {
+    *output = GetTestCaseNameParam();
+    return;
+  }
+
+  if (name == "getRootPaths") {
     // Pass the root paths.
     const scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
     res->SetString("downloads",
@@ -659,13 +675,17 @@ std::string FileManagerBrowserTestBase::OnMessage(const std::string& name,
     res->SetString("drive",
         "/" + drive::util::GetDriveMountPointPath(profile()
             ).BaseName().AsUTF8Unsafe() + "/root");
-    std::string jsonString;
-    base::JSONWriter::Write(res.get(), &jsonString);
-    return jsonString;
-  } else if (name == "isInGuestMode") {
+    base::JSONWriter::Write(res.get(), output);
+    return;
+  }
+
+  if (name == "isInGuestMode") {
     // Obtain whether the test is in guest mode or not.
-    return GetGuestModeParam() != NOT_IN_GUEST_MODE ? "true" : "false";
-  } else if (name == "getCwsWidgetContainerMockUrl") {
+    *output = GetGuestModeParam() != NOT_IN_GUEST_MODE ? "true" : "false";
+    return;
+  }
+
+  if (name == "getCwsWidgetContainerMockUrl") {
     // Obtain whether the test is in guest mode or not.
     const GURL url = embedded_test_server()->GetURL(
           "/chromeos/file_manager/cws_container_mock/index.html");
@@ -678,15 +698,16 @@ std::string FileManagerBrowserTestBase::OnMessage(const std::string& name,
     const scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
     res->SetString("url", url.spec());
     res->SetString("origin", origin);
-    std::string jsonString;
-    base::JSONWriter::Write(res.get(), &jsonString);
-    return jsonString;
-  } else if (name == "addEntries") {
+    base::JSONWriter::Write(res.get(), output);
+    return;
+  }
+
+  if (name == "addEntries") {
     // Add entries to the specified volume.
     base::JSONValueConverter<AddEntriesMessage> add_entries_message_converter;
     AddEntriesMessage message;
-    if (!add_entries_message_converter.Convert(*value, &message))
-      return "onError";
+    ASSERT_TRUE(add_entries_message_converter.Convert(value, &message));
+
     for (size_t i = 0; i < message.entries.size(); ++i) {
       switch (message.volume) {
         case LOCAL_VOLUME:
@@ -705,23 +726,52 @@ std::string FileManagerBrowserTestBase::OnMessage(const std::string& name,
           break;
       }
     }
-    return "onEntryAdded";
-  } else if (name == "mountFakeUsb") {
+
+    return;
+  }
+
+  if (name == "mountFakeUsb") {
     usb_volume_.reset(new FakeTestVolume("fake-usb",
                                          VOLUME_TYPE_REMOVABLE_DISK_PARTITION,
                                          chromeos::DEVICE_TYPE_USB));
     usb_volume_->Mount(profile());
-    return "true";
-  } else if (name == "mountFakeMtp") {
+    return;
+  }
+
+  if (name == "mountFakeMtp") {
     mtp_volume_.reset(new FakeTestVolume("fake-mtp",
                                          VOLUME_TYPE_MTP,
                                          chromeos::DEVICE_TYPE_UNKNOWN));
-    if (!mtp_volume_->PrepareTestEntries(profile()))
-      return "false";
+    ASSERT_TRUE(mtp_volume_->PrepareTestEntries(profile()));
+
     mtp_volume_->Mount(profile());
-    return "true";
+    return;
+  }
+
+  if (name == "useCellularNetwork") {
+    net::NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeForTests(
+        net::NetworkChangeNotifier::CONNECTION_3G);
+    return;
   }
-  return "unknownMessage";
+
+  if (name == "clickNotificationButton") {
+    std::string extension_id;
+    std::string notification_id;
+    int index;
+    ASSERT_TRUE(value.GetString("extensionId", &extension_id));
+    ASSERT_TRUE(value.GetString("notificationId", &notification_id));
+    ASSERT_TRUE(value.GetInteger("index", &index));
+
+    const std::string delegate_id = extension_id + "-" + notification_id;
+    const Notification* notification = g_browser_process->
+        notification_ui_manager()->FindById(delegate_id, profile());
+    ASSERT_TRUE(notification);
+
+    notification->delegate()->ButtonClick(index);
+    return;
+  }
+
+  FAIL() << "Unknown test message: " << name;
 }
 
 drive::DriveIntegrationService*
@@ -739,10 +789,10 @@ typedef std::tr1::tuple<GuestMode, const char*> TestParameter;
 class FileManagerBrowserTest :
       public FileManagerBrowserTestBase,
       public ::testing::WithParamInterface<TestParameter> {
-  virtual GuestMode GetGuestModeParam() const OVERRIDE {
+  virtual GuestMode GetGuestModeParam() const override {
     return std::tr1::get<0>(GetParam());
   }
-  virtual const char* GetTestCaseNameParam() const OVERRIDE {
+  virtual const char* GetTestCaseNameParam() const override {
     return std::tr1::get<1>(GetParam());
   }
 };
@@ -762,7 +812,8 @@ IN_PROC_BROWSER_TEST_P(FileManagerBrowserTest, Test) {
   INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator)
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_FileDisplay DISABLED_FileDisplay
 #else
 #define MAYBE_FileDisplay FileDisplay
@@ -784,7 +835,8 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
                       TestParameter(NOT_IN_GUEST_MODE, "zipOpenDrive")));
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_OpenVideoFiles DISABLED_OpenVideoFiles
 #else
 #define MAYBE_OpenVideoFiles OpenVideoFiles
@@ -797,7 +849,8 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
                       TestParameter(NOT_IN_GUEST_MODE, "videoOpenDrive")));
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_OpenAudioFiles DISABLED_OpenAudioFiles
 #else
 #define MAYBE_OpenAudioFiles OpenAudioFiles
@@ -829,7 +882,8 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
                                     "createNewFolderDrive")));
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_KeyboardOperations DISABLED_KeyboardOperations
 #else
 #define MAYBE_KeyboardOperations KeyboardOperations
@@ -846,10 +900,17 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
                       TestParameter(NOT_IN_GUEST_MODE, "keyboardCopyDrive"),
                       TestParameter(IN_GUEST_MODE, "renameFileDownloads"),
                       TestParameter(NOT_IN_GUEST_MODE, "renameFileDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE, "renameFileDrive")));
+                      TestParameter(NOT_IN_GUEST_MODE, "renameFileDrive"),
+                      TestParameter(IN_GUEST_MODE,
+                                    "renameNewDirectoryDownloads"),
+                      TestParameter(NOT_IN_GUEST_MODE,
+                                    "renameNewDirectoryDownloads"),
+                      TestParameter(NOT_IN_GUEST_MODE,
+                                    "renameNewDirectoryDrive")));
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_DriveSpecific DISABLED_DriveSpecific
 #else
 #define MAYBE_DriveSpecific DriveSpecific
@@ -857,14 +918,16 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
 WRAPPED_INSTANTIATE_TEST_CASE_P(
     MAYBE_DriveSpecific,
     FileManagerBrowserTest,
-    ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "openSidebarRecent"),
-                      TestParameter(NOT_IN_GUEST_MODE, "openSidebarOffline"),
-                      TestParameter(NOT_IN_GUEST_MODE,
-                                    "openSidebarSharedWithMe"),
-                      TestParameter(NOT_IN_GUEST_MODE, "autocomplete")));
+    ::testing::Values(
+        TestParameter(NOT_IN_GUEST_MODE, "openSidebarRecent"),
+        TestParameter(NOT_IN_GUEST_MODE, "openSidebarOffline"),
+        TestParameter(NOT_IN_GUEST_MODE, "openSidebarSharedWithMe"),
+        TestParameter(NOT_IN_GUEST_MODE, "autocomplete"),
+        TestParameter(NOT_IN_GUEST_MODE, "pinFileOnMobileNetwork")));
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_Transfer DISABLED_Transfer
 #else
 #define MAYBE_Transfer Transfer
@@ -883,7 +946,8 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
         TestParameter(NOT_IN_GUEST_MODE, "transferFromOfflineToDrive")));
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_RestorePrefs DISABLED_RestorePrefs
 #else
 #define MAYBE_RestorePrefs RestorePrefs
@@ -986,6 +1050,19 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
 #if !defined(NDEBUG)
+#define MAYBE_GenericTask DISABLED_GenericTask
+#else
+#define MAYBE_GenericTask GenericTask
+#endif
+WRAPPED_INSTANTIATE_TEST_CASE_P(
+    MAYBE_GenericTask,
+    FileManagerBrowserTest,
+    ::testing::Values(
+        TestParameter(NOT_IN_GUEST_MODE, "genericTaskIsNotExecuted"),
+        TestParameter(NOT_IN_GUEST_MODE, "genericAndNonGenericTasksAreMixed")));
+
+// Slow tests are disabled on debug build. http://crbug.com/327719
+#if !defined(NDEBUG)
 #define MAYBE_FolderShortcuts DISABLED_FolderShortcuts
 #else
 #define MAYBE_FolderShortcuts FolderShortcuts
@@ -1014,7 +1091,8 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
     ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "thumbnailsDownloads"),
                       TestParameter(IN_GUEST_MODE, "thumbnailsDownloads")));
 
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_OpenFileDialog DISABLED_OpenFileDialog
 #else
 #define MAYBE_OpenFileDialog OpenFileDialog
@@ -1031,7 +1109,9 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
                       TestParameter(IN_INCOGNITO,
                                     "openFileDialogOnDownloads"),
                       TestParameter(IN_INCOGNITO,
-                                    "openFileDialogOnDrive")));
+                                    "openFileDialogOnDrive"),
+                      TestParameter(NOT_IN_GUEST_MODE,
+                                    "unloadFileDialog")));
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
 #if !defined(NDEBUG)
@@ -1087,7 +1167,7 @@ static const TestAccountInfo kTestAccounts[] = {
 class MultiProfileFileManagerBrowserTest : public FileManagerBrowserTestBase {
  protected:
   // Enables multi-profiles.
-  virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+  virtual void SetUpCommandLine(CommandLine* command_line) override {
     FileManagerBrowserTestBase::SetUpCommandLine(command_line);
     // Logs in to a dummy profile (For making MultiProfileWindowManager happy;
     // browser test creates a default window and the manager tries to assign a
@@ -1099,7 +1179,7 @@ class MultiProfileFileManagerBrowserTest : public FileManagerBrowserTestBase {
   }
 
   // Logs in to the primary profile of this test.
-  virtual void SetUpOnMainThread() OVERRIDE {
+  virtual void SetUpOnMainThread() override {
     const TestAccountInfo& info = kTestAccounts[PRIMARY_ACCOUNT_INDEX];
 
     AddUser(info, true);
@@ -1115,7 +1195,7 @@ class MultiProfileFileManagerBrowserTest : public FileManagerBrowserTestBase {
   }
 
   // Returns primary profile (if it is already created.)
-  virtual Profile* profile() OVERRIDE {
+  virtual Profile* profile() override {
     Profile* const profile = chromeos::ProfileHelper::GetProfileByUserIdHash(
         kTestAccounts[PRIMARY_ACCOUNT_INDEX].hash);
     return profile ? profile : FileManagerBrowserTestBase::profile();
@@ -1137,42 +1217,20 @@ class MultiProfileFileManagerBrowserTest : public FileManagerBrowserTestBase {
   }
 
  private:
-  virtual GuestMode GetGuestModeParam() const OVERRIDE {
+  virtual GuestMode GetGuestModeParam() const override {
     return NOT_IN_GUEST_MODE;
   }
 
-  virtual const char* GetTestCaseNameParam() const OVERRIDE {
+  virtual const char* GetTestCaseNameParam() const override {
     return test_case_name_.c_str();
   }
 
-  virtual std::string OnMessage(const std::string& name,
-                                const base::Value* value) OVERRIDE {
-    if (name == "addAllUsers") {
-      AddAllUsers();
-      return "true";
-    } else if (name == "getWindowOwnerId") {
-      chrome::MultiUserWindowManager* const window_manager =
-          chrome::MultiUserWindowManager::GetInstance();
-      extensions::AppWindowRegistry* const app_window_registry =
-          extensions::AppWindowRegistry::Get(profile());
-      DCHECK(window_manager);
-      DCHECK(app_window_registry);
-
-      const extensions::AppWindowRegistry::AppWindowList& list =
-          app_window_registry->GetAppWindowsForApp(
-              file_manager::kFileManagerAppId);
-      return list.size() == 1u ?
-          window_manager->GetUserPresentingWindow(
-              list.front()->GetNativeWindow()) : "";
-    }
-    return FileManagerBrowserTestBase::OnMessage(name, value);
-  }
-
   std::string test_case_name_;
 };
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_PRE_BasicDownloads DISABLED_PRE_BasicDownloads
 #define MAYBE_BasicDownloads DISABLED_BasicDownloads
 #else
@@ -1194,7 +1252,8 @@ IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest,
 }
 
 // Slow tests are disabled on debug build. http://crbug.com/327719
-#if !defined(NDEBUG)
+// Fails on official build. http://crbug.com/429294
+#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
 #define MAYBE_PRE_BasicDrive DISABLED_PRE_BasicDrive
 #define MAYBE_BasicDrive DISABLED_BasicDrive
 #else
@@ -1217,22 +1276,23 @@ IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, MAYBE_BasicDrive) {
 template<GuestMode M>
 class GalleryBrowserTestBase : public FileManagerBrowserTestBase {
  public:
-  virtual GuestMode GetGuestModeParam() const OVERRIDE { return M; }
-  virtual const char* GetTestCaseNameParam() const OVERRIDE {
+  virtual GuestMode GetGuestModeParam() const override { return M; }
+  virtual const char* GetTestCaseNameParam() const override {
     return test_case_name_.c_str();
   }
 
  protected:
-  virtual void SetUp() OVERRIDE {
+  virtual void SetUp() override {
     AddScript("common/test_util_common.js");
     AddScript("gallery/test_util.js");
     FileManagerBrowserTestBase::SetUp();
   }
 
-  virtual std::string OnMessage(const std::string& name,
-                                const base::Value* value) OVERRIDE;
+  virtual void OnMessage(const std::string& name,
+                         const base::DictionaryValue& value,
+                         std::string* output) override;
 
-  virtual const char* GetTestManifestName() const OVERRIDE {
+  virtual const char* GetTestManifestName() const override {
     return "gallery_test_manifest.json";
   }
 
@@ -1250,15 +1310,17 @@ class GalleryBrowserTestBase : public FileManagerBrowserTestBase {
   std::string test_case_name_;
 };
 
-template<GuestMode M>
-std::string GalleryBrowserTestBase<M>::OnMessage(const std::string& name,
-                                                 const base::Value* value) {
+template <GuestMode M>
+void GalleryBrowserTestBase<M>::OnMessage(const std::string& name,
+                                          const base::DictionaryValue& value,
+                                          std::string* output) {
   if (name == "getScripts") {
     std::string jsonString;
-    base::JSONWriter::Write(&scripts_, &jsonString);
-    return jsonString;
+    base::JSONWriter::Write(&scripts_, output);
+    return;
   }
-  return FileManagerBrowserTestBase::OnMessage(name, value);
+
+  FileManagerBrowserTestBase::OnMessage(name, value, output);
 }
 
 typedef GalleryBrowserTestBase<NOT_IN_GUEST_MODE> GalleryBrowserTest;
@@ -1419,28 +1481,29 @@ IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, ExposureImageOnDrive) {
 template<GuestMode M>
 class VideoPlayerBrowserTestBase : public FileManagerBrowserTestBase {
  public:
-  virtual GuestMode GetGuestModeParam() const OVERRIDE { return M; }
-  virtual const char* GetTestCaseNameParam() const OVERRIDE {
+  virtual GuestMode GetGuestModeParam() const override { return M; }
+  virtual const char* GetTestCaseNameParam() const override {
     return test_case_name_.c_str();
   }
 
  protected:
-  virtual void SetUp() OVERRIDE {
+  virtual void SetUp() override {
     AddScript("common/test_util_common.js");
     AddScript("video_player/test_util.js");
     FileManagerBrowserTestBase::SetUp();
   }
 
-  virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+  virtual void SetUpCommandLine(CommandLine* command_line) override {
     command_line->AppendSwitch(
         chromeos::switches::kEnableVideoPlayerChromecastSupport);
     FileManagerBrowserTestBase::SetUpCommandLine(command_line);
   }
 
-  virtual std::string OnMessage(const std::string& name,
-                                const base::Value* value) OVERRIDE;
+  virtual void OnMessage(const std::string& name,
+                         const base::DictionaryValue& value,
+                         std::string* output) override;
 
-  virtual const char* GetTestManifestName() const OVERRIDE {
+  virtual const char* GetTestManifestName() const override {
     return "video_player_test_manifest.json";
   }
 
@@ -1458,15 +1521,18 @@ class VideoPlayerBrowserTestBase : public FileManagerBrowserTestBase {
   std::string test_case_name_;
 };
 
-template<GuestMode M>
-std::string VideoPlayerBrowserTestBase<M>::OnMessage(const std::string& name,
-                                                     const base::Value* value) {
+template <GuestMode M>
+void VideoPlayerBrowserTestBase<M>::OnMessage(
+    const std::string& name,
+    const base::DictionaryValue& value,
+    std::string* output) {
   if (name == "getScripts") {
     std::string jsonString;
-    base::JSONWriter::Write(&scripts_, &jsonString);
-    return jsonString;
+    base::JSONWriter::Write(&scripts_, output);
+    return;
   }
-  return FileManagerBrowserTestBase::OnMessage(name, value);
+
+  FileManagerBrowserTestBase::OnMessage(name, value, output);
 }
 
 typedef VideoPlayerBrowserTestBase<NOT_IN_GUEST_MODE> VideoPlayerBrowserTest;