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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/prefs/pref_service.h" | 6 #include "chrome/browser/prefs/pref_service.h" |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
11 | 11 |
12 class DownloadsApiTest : public ExtensionApiTest { | 12 class DownloadsApiTest : public ExtensionApiTest { |
13 public: | 13 public: |
14 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 14 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
15 ExtensionApiTest::SetUpCommandLine(command_line); | 15 ExtensionApiTest::SetUpCommandLine(command_line); |
16 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 16 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
17 } | 17 } |
18 | 18 |
19 void SetUpTempDownloadsDir() { | 19 void SetUpTempDownloadsDir() { |
20 ASSERT_TRUE(tmpdir.CreateUniqueTempDir()); | 20 ASSERT_TRUE(tmpdir.CreateUniqueTempDir()); |
21 browser()->profile()->GetPrefs()->SetFilePath( | 21 browser()->profile()->GetPrefs()->SetFilePath( |
22 prefs::kDownloadDefaultDirectory, tmpdir.path()); | 22 prefs::kDownloadDefaultDirectory, tmpdir.path()); |
23 } | 23 } |
24 | 24 |
25 private: | 25 private: |
26 ScopedTempDir tmpdir; | 26 ScopedTempDir tmpdir; |
27 }; | 27 }; |
28 | 28 |
29 // Disabled on Mac. http://crbug.com/101170 | 29 IN_PROC_BROWSER_TEST_F(DownloadsApiTest, Downloads) { |
30 #if defined(OS_MACOSX) | |
31 #define MAYBE_Downloads DISABLED_Downloads | |
32 #else | |
33 #define MAYBE_Downloads Downloads | |
34 #endif | |
35 IN_PROC_BROWSER_TEST_F(DownloadsApiTest, MAYBE_Downloads) { | |
36 SetUpTempDownloadsDir(); | 30 SetUpTempDownloadsDir(); |
37 ASSERT_TRUE(StartTestServer()); | 31 ASSERT_TRUE(StartTestServer()); |
38 ASSERT_TRUE(RunExtensionTest("downloads")) << message_; | 32 ASSERT_TRUE(RunExtensionTest("downloads")) << message_; |
39 } | 33 } |
OLD | NEW |