Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/path_service.h" | 5 #include "base/path_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 // On the Mac this winds up using some autoreleased objects, so we need to | 44 // On the Mac this winds up using some autoreleased objects, so we need to |
| 45 // be a PlatformTest. | 45 // be a PlatformTest. |
| 46 typedef PlatformTest PathServiceTest; | 46 typedef PlatformTest PathServiceTest; |
| 47 | 47 |
| 48 // Test that all PathService::Get calls return a value and a true result | 48 // Test that all PathService::Get calls return a value and a true result |
| 49 // in the development environment. (This test was created because a few | 49 // in the development environment. (This test was created because a few |
| 50 // later changes to Get broke the semantics of the function and yielded the | 50 // later changes to Get broke the semantics of the function and yielded the |
| 51 // correct value while returning false.) | 51 // correct value while returning false.) |
| 52 TEST_F(PathServiceTest, Get) { | 52 TEST_F(PathServiceTest, Get) { |
| 53 #if defined(OS_ANDROID) | |
| 54 EXPECT_PRED1(ReturnsValidPath, static_cast<int>(base::FILE_EXE)); | |
| 55 EXPECT_PRED1(ReturnsValidPath, static_cast<int>(base::DIR_MODULE)); | |
| 56 EXPECT_PRED1(ReturnsValidPath, static_cast<int>(base::DIR_SOURCE_ROOT)); | |
| 57 EXPECT_PRED1(ReturnsValidPath, static_cast<int>(base::DIR_CACHE)); | |
| 58 #else | |
| 53 for (int key = base::DIR_CURRENT; key < base::PATH_END; ++key) { | 59 for (int key = base::DIR_CURRENT; key < base::PATH_END; ++key) { |
|
brettw
2011/08/24 20:46:58
Why doesn't this code work on Android? It seems li
michaelbai
2011/08/24 23:02:18
The FILE_MODULE is not implemented in Android.
brettw
2011/08/24 23:17:13
It seems like the correct solution then is to impl
michaelbai
2011/08/25 17:26:16
I could implement the FILE_MODULE, but the issue i
brettw
2011/08/25 17:49:10
I guess we can leave FILE_MODULE unimplemented. In
michaelbai
2011/08/25 18:09:52
Done.
| |
| 54 EXPECT_PRED1(ReturnsValidPath, key); | 60 EXPECT_PRED1(ReturnsValidPath, key); |
| 55 } | 61 } |
| 62 #endif | |
| 56 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
| 57 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { | 64 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { |
| 58 if (key == base::DIR_LOCAL_APP_DATA_LOW && | 65 if (key == base::DIR_LOCAL_APP_DATA_LOW && |
| 59 base::win::GetVersion() < base::win::VERSION_VISTA) { | 66 base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 60 // DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected to | 67 // DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected to |
| 61 // fail. | 68 // fail. |
| 62 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; | 69 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; |
| 63 } else { | 70 } else { |
| 64 EXPECT_TRUE(ReturnsValidPath(key)) << key; | 71 EXPECT_TRUE(ReturnsValidPath(key)) << key; |
| 65 } | 72 } |
| 66 } | 73 } |
| 67 #elif defined(OS_MACOSX) | 74 #elif defined(OS_MACOSX) |
| 68 for (int key = base::PATH_MAC_START + 1; key < base::PATH_MAC_END; ++key) { | 75 for (int key = base::PATH_MAC_START + 1; key < base::PATH_MAC_END; ++key) { |
| 69 EXPECT_PRED1(ReturnsValidPath, key); | 76 EXPECT_PRED1(ReturnsValidPath, key); |
| 70 } | 77 } |
| 71 #endif | 78 #endif |
| 72 } | 79 } |
| OLD | NEW |