| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/version.h" | 12 #include "base/version.h" |
| 13 #include "chrome/browser/component_updater/crx_update_item.h" | 13 #include "chrome/browser/component_updater/crx_update_item.h" |
| 14 #include "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" | 14 #include "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" |
| 15 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h" | 15 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h" |
| 16 #include "chrome/browser/component_updater/update_checker.h" | 16 #include "chrome/browser/component_updater/update_checker.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
| 20 #include "net/url_request/url_fetcher.h" | 20 #include "net/url_request/url_fetcher.h" |
| 21 #include "net/url_request/url_request_test_util.h" | 21 #include "net/url_request/url_request_test_util.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using content::BrowserThread; | 24 using content::BrowserThread; |
| 25 | 25 |
| 26 namespace component_updater { | 26 namespace component_updater { |
| 27 | 27 |
| 28 namespace { |
| 29 |
| 28 base::FilePath test_file(const char* file) { | 30 base::FilePath test_file(const char* file) { |
| 29 base::FilePath path; | 31 base::FilePath path; |
| 30 PathService::Get(chrome::DIR_TEST_DATA, &path); | 32 PathService::Get(chrome::DIR_TEST_DATA, &path); |
| 31 return path.AppendASCII("components").AppendASCII(file); | 33 return path.AppendASCII("components").AppendASCII(file); |
| 32 } | 34 } |
| 33 | 35 |
| 36 } // namespace |
| 37 |
| 34 class UpdateCheckerTest : public testing::Test { | 38 class UpdateCheckerTest : public testing::Test { |
| 35 public: | 39 public: |
| 36 UpdateCheckerTest(); | 40 UpdateCheckerTest(); |
| 37 virtual ~UpdateCheckerTest(); | 41 virtual ~UpdateCheckerTest(); |
| 38 | 42 |
| 39 // Overrides from testing::Test. | 43 // Overrides from testing::Test. |
| 40 virtual void SetUp() OVERRIDE; | 44 virtual void SetUp() OVERRIDE; |
| 41 virtual void TearDown() OVERRIDE; | 45 virtual void TearDown() OVERRIDE; |
| 42 | 46 |
| 43 void UpdateCheckComplete(int error, | 47 void UpdateCheckComplete(int error, |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 EXPECT_EQ(1, post_interceptor_->GetCount()) | 227 EXPECT_EQ(1, post_interceptor_->GetCount()) |
| 224 << post_interceptor_->GetRequestsAsString(); | 228 << post_interceptor_->GetRequestsAsString(); |
| 225 | 229 |
| 226 EXPECT_NE(0, error_); | 230 EXPECT_NE(0, error_); |
| 227 EXPECT_STREQ("network error", error_message_.c_str()); | 231 EXPECT_STREQ("network error", error_message_.c_str()); |
| 228 EXPECT_EQ(0ul, results_.list.size()); | 232 EXPECT_EQ(0ul, results_.list.size()); |
| 229 } | 233 } |
| 230 | 234 |
| 231 } // namespace component_updater | 235 } // namespace component_updater |
| 232 | 236 |
| OLD | NEW |