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

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

Issue 493953002: Componentize component_updater: Move a bunch of tests to component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
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").AppendASCII("test").AppendASCII("data")
61 .AppendASCII("component_updater").AppendASCII(file);
61 } 62 }
62 63
63 } // namespace 64 } // namespace
64 65
65 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { 66 ComponentPatcherOperationTest::ComponentPatcherOperationTest() {
66 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); 67 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir());
67 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); 68 EXPECT_TRUE(input_dir_.CreateUniqueTempDir());
68 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); 69 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir());
69 installer_.reset(new ReadOnlyTestInstaller(installed_dir_.path())); 70 installer_.reset(new ReadOnlyTestInstaller(installed_dir_.path()));
70 task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( 71 task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread(
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 199
199 EXPECT_EQ(true, callback.called_); 200 EXPECT_EQ(true, callback.called_);
200 EXPECT_EQ(ComponentUnpacker::kNone, callback.error_); 201 EXPECT_EQ(ComponentUnpacker::kNone, callback.error_);
201 EXPECT_EQ(0, callback.extra_code_); 202 EXPECT_EQ(0, callback.extra_code_);
202 EXPECT_TRUE(base::ContentsEqual( 203 EXPECT_TRUE(base::ContentsEqual(
203 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), 204 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")),
204 test_file("binary_output.bin"))); 205 test_file("binary_output.bin")));
205 } 206 }
206 207
207 } // namespace component_updater 208 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698