| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 const char kExternalDataPath[] = "policy/blank.html"; | 39 const char kExternalDataPath[] = "policy/blank.html"; |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 typedef InProcessBrowserTest UserCloudExternalDataManagerTest; | 43 typedef InProcessBrowserTest UserCloudExternalDataManagerTest; |
| 44 | 44 |
| 45 IN_PROC_BROWSER_TEST_F(UserCloudExternalDataManagerTest, FetchExternalData) { | 45 IN_PROC_BROWSER_TEST_F(UserCloudExternalDataManagerTest, FetchExternalData) { |
| 46 CloudExternalDataManagerBase::SetMaxExternalDataSizeForTesting(1000); | 46 CloudExternalDataManagerBase::SetMaxExternalDataSizeForTesting(1000); |
| 47 | 47 |
| 48 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 48 ASSERT_TRUE(embedded_test_server()->Start()); |
| 49 const GURL url = | 49 const GURL url = |
| 50 embedded_test_server()->GetURL(std::string("/") + kExternalDataPath); | 50 embedded_test_server()->GetURL(std::string("/") + kExternalDataPath); |
| 51 | 51 |
| 52 base::FilePath test_dir; | 52 base::FilePath test_dir; |
| 53 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 53 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
| 54 std::string external_data; | 54 std::string external_data; |
| 55 ASSERT_TRUE(base::ReadFileToString(test_dir.AppendASCII(kExternalDataPath), | 55 ASSERT_TRUE(base::ReadFileToString(test_dir.AppendASCII(kExternalDataPath), |
| 56 &external_data)); | 56 &external_data)); |
| 57 ASSERT_FALSE(external_data.empty()); | 57 ASSERT_FALSE(external_data.empty()); |
| 58 | 58 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 &test::ExternalDataFetchCallback, | 92 &test::ExternalDataFetchCallback, |
| 93 &fetched_external_data, | 93 &fetched_external_data, |
| 94 run_loop.QuitClosure())); | 94 run_loop.QuitClosure())); |
| 95 run_loop.Run(); | 95 run_loop.Run(); |
| 96 | 96 |
| 97 ASSERT_TRUE(fetched_external_data); | 97 ASSERT_TRUE(fetched_external_data); |
| 98 EXPECT_EQ(external_data, *fetched_external_data); | 98 EXPECT_EQ(external_data, *fetched_external_data); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace policy | 101 } // namespace policy |
| OLD | NEW |