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" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 EXPECT_EQ(std::string("app3"), apps[2]); | 93 EXPECT_EQ(std::string("app3"), apps[2]); |
94 } | 94 } |
95 | 95 |
96 // Tests none-existent order file gives built-in default. | 96 // Tests none-existent order file gives built-in default. |
97 TEST_F(DefaultAppOrderTest, NoExternalFile) { | 97 TEST_F(DefaultAppOrderTest, NoExternalFile) { |
98 base::ScopedTempDir scoped_tmp_dir; | 98 base::ScopedTempDir scoped_tmp_dir; |
99 ASSERT_TRUE(scoped_tmp_dir.CreateUniqueTempDir()); | 99 ASSERT_TRUE(scoped_tmp_dir.CreateUniqueTempDir()); |
100 | 100 |
101 base::FilePath none_existent_file = | 101 base::FilePath none_existent_file = |
102 scoped_tmp_dir.path().AppendASCII("none_existent_file"); | 102 scoped_tmp_dir.path().AppendASCII("none_existent_file"); |
103 ASSERT_FALSE(file_util::PathExists(none_existent_file)); | 103 ASSERT_FALSE(base::PathExists(none_existent_file)); |
104 SetExternalFile(none_existent_file); | 104 SetExternalFile(none_existent_file); |
105 | 105 |
106 scoped_ptr<default_app_order::ExternalLoader> loader( | 106 scoped_ptr<default_app_order::ExternalLoader> loader( |
107 new default_app_order::ExternalLoader(false)); | 107 new default_app_order::ExternalLoader(false)); |
108 | 108 |
109 std::vector<std::string> apps; | 109 std::vector<std::string> apps; |
110 default_app_order::Get(&apps); | 110 default_app_order::Get(&apps); |
111 EXPECT_TRUE(IsBuiltInDefault(apps)); | 111 EXPECT_TRUE(IsBuiltInDefault(apps)); |
112 } | 112 } |
113 | 113 |
114 // Tests bad json file gives built-in default. | 114 // Tests bad json file gives built-in default. |
115 TEST_F(DefaultAppOrderTest, BadExternalFile) { | 115 TEST_F(DefaultAppOrderTest, BadExternalFile) { |
116 const char kExternalOrder[] = "This is not a valid json."; | 116 const char kExternalOrder[] = "This is not a valid json."; |
117 CreateExternalOrderFile(std::string(kExternalOrder)); | 117 CreateExternalOrderFile(std::string(kExternalOrder)); |
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 |