| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return base::Bind(&Receiver::DidReadFile, base::Unretained(this)); | 38 return base::Bind(&Receiver::DidReadFile, base::Unretained(this)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool succeeded() const { return succeeded_; } | 41 bool succeeded() const { return succeeded_; } |
| 42 const std::string& data() const { return data_; } | 42 const std::string& data() const { return data_; } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 void DidReadFile(bool success, const std::string& data) { | 45 void DidReadFile(bool success, const std::string& data) { |
| 46 succeeded_ = success; | 46 succeeded_ = success; |
| 47 data_ = data; | 47 data_ = data; |
| 48 base::MessageLoop::current()->Quit(); | 48 base::MessageLoop::current()->QuitWhenIdle(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool succeeded_; | 51 bool succeeded_; |
| 52 std::string data_; | 52 std::string data_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 void RunBasicTest(const char* filename) { | 55 void RunBasicTest(const char* filename) { |
| 56 base::FilePath path; | 56 base::FilePath path; |
| 57 PathService::Get(DIR_TEST_DATA, &path); | 57 PathService::Get(DIR_TEST_DATA, &path); |
| 58 std::string extension_id = crx_file::id_util::GenerateId("test"); | 58 std::string extension_id = crx_file::id_util::GenerateId("test"); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 scoped_refptr<FileReader> file_reader( | 96 scoped_refptr<FileReader> file_reader( |
| 97 new FileReader(resource, receiver.NewCallback())); | 97 new FileReader(resource, receiver.NewCallback())); |
| 98 file_reader->Start(); | 98 file_reader->Start(); |
| 99 | 99 |
| 100 base::MessageLoop::current()->Run(); | 100 base::MessageLoop::current()->Run(); |
| 101 | 101 |
| 102 EXPECT_FALSE(receiver.succeeded()); | 102 EXPECT_FALSE(receiver.succeeded()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace extensions | 105 } // namespace extensions |
| OLD | NEW |