Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: components/component_updater/test/component_patcher_unittest.cc

Issue 508473002: Componentize component_updater: Move URLRequestPrepackagedInterceptor from content/ to net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run git cl format Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/base_paths.h"
5 #include "base/bind.h" 6 #include "base/bind.h"
6 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
7 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
10 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "base/run_loop.h" 13 #include "base/run_loop.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/component_updater/test/component_patcher_unittest.h"
15 #include "chrome/browser/component_updater/test/test_installer.h"
16 #include "chrome/common/chrome_paths.h"
17 #include "components/component_updater/component_patcher.h" 15 #include "components/component_updater/component_patcher.h"
18 #include "components/component_updater/component_patcher_operation.h" 16 #include "components/component_updater/component_patcher_operation.h"
19 #include "components/component_updater/component_updater_service.h" 17 #include "components/component_updater/component_updater_service.h"
18 #include "components/component_updater/test/component_patcher_unittest.h"
19 #include "components/component_updater/test/test_installer.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "courgette/courgette.h" 21 #include "courgette/courgette.h"
22 #include "courgette/third_party/bsdiff.h" 22 #include "courgette/third_party/bsdiff.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 namespace { 25 namespace {
26 26
27 class TestCallback { 27 class TestCallback {
28 public: 28 public:
29 TestCallback(); 29 TestCallback();
(...skipping 19 matching lines...) Expand all
49 } 49 }
50 50
51 } // namespace 51 } // namespace
52 52
53 namespace component_updater { 53 namespace component_updater {
54 54
55 namespace { 55 namespace {
56 56
57 base::FilePath test_file(const char* file) { 57 base::FilePath test_file(const char* file) {
58 base::FilePath path; 58 base::FilePath path;
59 PathService::Get(chrome::DIR_TEST_DATA, &path); 59 PathService::Get(base::DIR_SOURCE_ROOT, &path);
60 return path.AppendASCII("components").AppendASCII(file); 60 return path.AppendASCII("components")
61 .AppendASCII("test")
62 .AppendASCII("data")
63 .AppendASCII("component_updater")
64 .AppendASCII(file);
61 } 65 }
62 66
63 } // namespace 67 } // namespace
64 68
65 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { 69 ComponentPatcherOperationTest::ComponentPatcherOperationTest() {
66 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); 70 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir());
67 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); 71 EXPECT_TRUE(input_dir_.CreateUniqueTempDir());
68 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); 72 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir());
69 installer_.reset(new ReadOnlyTestInstaller(installed_dir_.path())); 73 installer_.reset(new ReadOnlyTestInstaller(installed_dir_.path()));
70 task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( 74 task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread(
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 202
199 EXPECT_EQ(true, callback.called_); 203 EXPECT_EQ(true, callback.called_);
200 EXPECT_EQ(ComponentUnpacker::kNone, callback.error_); 204 EXPECT_EQ(ComponentUnpacker::kNone, callback.error_);
201 EXPECT_EQ(0, callback.extra_code_); 205 EXPECT_EQ(0, callback.extra_code_);
202 EXPECT_TRUE(base::ContentsEqual( 206 EXPECT_TRUE(base::ContentsEqual(
203 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), 207 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")),
204 test_file("binary_output.bin"))); 208 test_file("binary_output.bin")));
205 } 209 }
206 210
207 } // namespace component_updater 211 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698