| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 10 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| 11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 | 13 |
| 14 #if defined(OS_LINUX) | 14 #if defined(OS_LINUX) |
| 15 #include <fstream> | 15 #include <fstream> |
| 16 | 16 |
| 17 #include "base/environment.h" | 17 #include "base/environment.h" |
| 18 #include "base/scoped_temp_dir.h" | 18 #include "base/scoped_temp_dir.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 using extensions::PlatformAppBrowserTest; |
| 22 |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 class ExperimentalMediaGalleriesAppBrowserTest | |
| 24 : public extensions::PlatformAppBrowserTest { | |
| 25 public: | |
| 26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
| 27 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); | |
| 28 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | |
| 29 } | |
| 30 }; | |
| 31 | |
| 32 class ExperimentalMediaGalleriesApiTest : public ExtensionApiTest { | 25 class ExperimentalMediaGalleriesApiTest : public ExtensionApiTest { |
| 33 public: | 26 public: |
| 34 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 27 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 35 ExtensionApiTest::SetUpCommandLine(command_line); | 28 ExtensionApiTest::SetUpCommandLine(command_line); |
| 36 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 29 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 37 } | 30 } |
| 38 }; | 31 }; |
| 39 | 32 |
| 40 class EnsurePictureDirectoryExists { | 33 class EnsurePictureDirectoryExists { |
| 41 public: | 34 public: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 69 } | 62 } |
| 70 | 63 |
| 71 #if defined(OS_LINUX) | 64 #if defined(OS_LINUX) |
| 72 ScopedTempDir xdg_dir_; | 65 ScopedTempDir xdg_dir_; |
| 73 #endif | 66 #endif |
| 74 }; | 67 }; |
| 75 | 68 |
| 76 | 69 |
| 77 } // namespace | 70 } // namespace |
| 78 | 71 |
| 79 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest, NoGalleries) { | 72 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, NoGalleries) { |
| 80 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_galleries")) | 73 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_galleries")) |
| 81 << message_; | 74 << message_; |
| 82 } | 75 } |
| 83 | 76 |
| 84 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest, | 77 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MediaGalleriesRead) { |
| 85 MediaGalleriesRead) { | |
| 86 EnsurePictureDirectoryExists picture_directory; | 78 EnsurePictureDirectoryExists picture_directory; |
| 87 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/read_access")) | 79 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/read_access")) |
| 88 << message_; | 80 << message_; |
| 89 } | 81 } |
| 90 | 82 |
| 91 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest, | 83 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MediaGalleriesNoAccess) { |
| 92 MediaGalleriesNoAccess) { | |
| 93 EnsurePictureDirectoryExists picture_directory; | 84 EnsurePictureDirectoryExists picture_directory; |
| 94 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_access")) | 85 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_access")) |
| 95 << message_; | 86 << message_; |
| 96 } | 87 } |
| 97 | 88 |
| 98 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesApiTest, | 89 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesApiTest, |
| 99 ExperimentalMediaGalleries) { | 90 ExperimentalMediaGalleries) { |
| 100 ASSERT_TRUE(RunExtensionTest("media_galleries/experimental")) << message_; | 91 ASSERT_TRUE(RunExtensionTest("media_galleries/experimental")) << message_; |
| 101 } | 92 } |
| OLD | NEW |