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 namespace { | 21 namespace { |
22 | 22 |
| 23 class ExperimentalMediaGalleriesAppBrowserTest : public PlatformAppBrowserTest { |
| 24 public: |
| 25 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 26 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 27 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 28 } |
| 29 }; |
| 30 |
23 class ExperimentalMediaGalleriesApiTest : public ExtensionApiTest { | 31 class ExperimentalMediaGalleriesApiTest : public ExtensionApiTest { |
24 public: | 32 public: |
25 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 33 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
26 ExtensionApiTest::SetUpCommandLine(command_line); | 34 ExtensionApiTest::SetUpCommandLine(command_line); |
27 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 35 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
28 } | 36 } |
29 }; | 37 }; |
30 | 38 |
31 class EnsurePictureDirectoryExists { | 39 class EnsurePictureDirectoryExists { |
32 public: | 40 public: |
(...skipping 27 matching lines...) Expand all Loading... |
60 } | 68 } |
61 | 69 |
62 #if defined(OS_LINUX) | 70 #if defined(OS_LINUX) |
63 ScopedTempDir xdg_dir_; | 71 ScopedTempDir xdg_dir_; |
64 #endif | 72 #endif |
65 }; | 73 }; |
66 | 74 |
67 | 75 |
68 } // namespace | 76 } // namespace |
69 | 77 |
70 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, NoGalleries) { | 78 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest, NoGalleries) { |
71 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_galleries")) | 79 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_galleries")) |
72 << message_; | 80 << message_; |
73 } | 81 } |
74 | 82 |
75 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MediaGalleriesRead) { | 83 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest, |
| 84 MediaGalleriesRead) { |
76 EnsurePictureDirectoryExists picture_directory; | 85 EnsurePictureDirectoryExists picture_directory; |
77 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/read_access")) | 86 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/read_access")) |
78 << message_; | 87 << message_; |
79 } | 88 } |
80 | 89 |
81 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MediaGalleriesNoAccess) { | 90 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest, |
| 91 MediaGalleriesNoAccess) { |
82 EnsurePictureDirectoryExists picture_directory; | 92 EnsurePictureDirectoryExists picture_directory; |
83 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_access")) | 93 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_access")) |
84 << message_; | 94 << message_; |
85 } | 95 } |
86 | 96 |
87 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesApiTest, | 97 IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesApiTest, |
88 ExperimentalMediaGalleries) { | 98 ExperimentalMediaGalleries) { |
89 ASSERT_TRUE(RunExtensionTest("media_galleries/experimental")) << message_; | 99 ASSERT_TRUE(RunExtensionTest("media_galleries/experimental")) << message_; |
90 } | 100 } |
OLD | NEW |