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/chromeos/extensions/default_app_order.h" | 5 #include "chrome/browser/chromeos/extensions/default_app_order.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/scoped_temp_dir.h" | |
15 #include "base/test/scoped_path_override.h" | 15 #include "base/test/scoped_path_override.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 const FilePath::CharType kTestFile[] = | 23 const FilePath::CharType kTestFile[] = |
24 FILE_PATH_LITERAL("test_default_app_order.json"); | 24 FILE_PATH_LITERAL("test_default_app_order.json"); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void CreateExternalOrderFile(const std::string& content) { | 56 void CreateExternalOrderFile(const std::string& content) { |
57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
58 FilePath external_file = temp_dir_.path().Append(kTestFile); | 58 FilePath external_file = temp_dir_.path().Append(kTestFile); |
59 file_util::WriteFile(external_file, content.c_str(), content.size()); | 59 file_util::WriteFile(external_file, content.c_str(), content.size()); |
60 SetExternalFile(external_file); | 60 SetExternalFile(external_file); |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 std::vector<std::string> built_in_default_; | 64 std::vector<std::string> built_in_default_; |
65 | 65 |
66 ScopedTempDir temp_dir_; | 66 base::ScopedTempDir temp_dir_; |
67 scoped_ptr<base::ScopedPathOverride> path_override_; | 67 scoped_ptr<base::ScopedPathOverride> path_override_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(DefaultAppOrderTest); | 69 DISALLOW_COPY_AND_ASSIGN(DefaultAppOrderTest); |
70 }; | 70 }; |
71 | 71 |
72 // Tests that the built-in default order is returned when ExternalLoader is not | 72 // Tests that the built-in default order is returned when ExternalLoader is not |
73 // created. | 73 // created. |
74 TEST_F(DefaultAppOrderTest, BuiltInDefault) { | 74 TEST_F(DefaultAppOrderTest, BuiltInDefault) { |
75 std::vector<std::string> apps; | 75 std::vector<std::string> apps; |
76 default_app_order::Get(&apps); | 76 default_app_order::Get(&apps); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 scoped_ptr<default_app_order::ExternalLoader> loader( | 113 scoped_ptr<default_app_order::ExternalLoader> loader( |
114 new default_app_order::ExternalLoader(false)); | 114 new default_app_order::ExternalLoader(false)); |
115 | 115 |
116 std::vector<std::string> apps; | 116 std::vector<std::string> apps; |
117 default_app_order::Get(&apps); | 117 default_app_order::Get(&apps); |
118 EXPECT_TRUE(IsBuiltInDefault(apps)); | 118 EXPECT_TRUE(IsBuiltInDefault(apps)); |
119 } | 119 } |
120 | 120 |
121 } // namespace chromeos | 121 } // namespace chromeos |
OLD | NEW |