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_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.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 "chromeos/chromeos_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 base::FilePath::CharType kTestFile[] = | 23 const base::FilePath::CharType kTestFile[] = |
24 FILE_PATH_LITERAL("test_default_app_order.json"); | 24 FILE_PATH_LITERAL("test_default_app_order.json"); |
25 } | 25 } |
26 | 26 |
(...skipping 16 matching lines...) Expand all Loading... |
43 for (size_t i = 0; i < built_in_default_.size(); ++i) { | 43 for (size_t i = 0; i < built_in_default_.size(); ++i) { |
44 if (built_in_default_[i] != apps[i]) | 44 if (built_in_default_[i] != apps[i]) |
45 return false; | 45 return false; |
46 } | 46 } |
47 | 47 |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 void SetExternalFile(const base::FilePath& path) { | 51 void SetExternalFile(const base::FilePath& path) { |
52 path_override_.reset(new base::ScopedPathOverride( | 52 path_override_.reset(new base::ScopedPathOverride( |
53 chrome::FILE_DEFAULT_APP_ORDER, path)); | 53 chromeos::FILE_DEFAULT_APP_ORDER, path)); |
54 } | 54 } |
55 | 55 |
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 base::FilePath external_file = temp_dir_.path().Append(kTestFile); | 58 base::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: |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 scoped_ptr<default_app_order::ExternalLoader> loader( | 119 scoped_ptr<default_app_order::ExternalLoader> loader( |
120 new default_app_order::ExternalLoader(false)); | 120 new default_app_order::ExternalLoader(false)); |
121 | 121 |
122 std::vector<std::string> apps; | 122 std::vector<std::string> apps; |
123 default_app_order::Get(&apps); | 123 default_app_order::Get(&apps); |
124 EXPECT_TRUE(IsBuiltInDefault(apps)); | 124 EXPECT_TRUE(IsBuiltInDefault(apps)); |
125 } | 125 } |
126 | 126 |
127 } // namespace chromeos | 127 } // namespace chromeos |
OLD | NEW |