Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/test/test_content_client.h" | 5 #include "content/test/test_content_client.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 TestContentClient::TestContentClient() | 15 TestContentClient::TestContentClient() |
| 16 : data_pack_(ui::SCALE_FACTOR_100P) { | 16 : data_pack_(ui::SCALE_FACTOR_100P) { |
| 17 // content_resources.pak is not built on iOS as it is not required. | 17 base::FilePath content_shell_pack_path; |
| 18 #if !defined(OS_IOS) | |
| 19 base::FilePath content_resources_pack_path; | |
| 20 #if defined(OS_ANDROID) | 18 #if defined(OS_ANDROID) |
| 21 // on Android all pak files are inside the paks folder. | 19 // on Android all pak files are inside the paks folder. |
| 22 PathService::Get(base::DIR_ANDROID_APP_DATA, &content_resources_pack_path); | 20 PathService::Get(base::DIR_ANDROID_APP_DATA, &content_shell_pack_path); |
| 23 content_resources_pack_path = content_resources_pack_path.Append( | 21 content_shell_pack_path = content_shell_pack_path.Append( |
| 24 FILE_PATH_LITERAL("paks")); | 22 FILE_PATH_LITERAL("paks")); |
| 25 #else | 23 #else |
| 26 PathService::Get(base::DIR_MODULE, &content_resources_pack_path); | 24 PathService::Get(base::DIR_MODULE, &content_shell_pack_path); |
| 27 #endif | 25 #endif |
| 28 content_resources_pack_path = content_resources_pack_path.Append( | 26 content_shell_pack_path = content_shell_pack_path.Append( |
| 29 FILE_PATH_LITERAL("content_resources.pak")); | 27 FILE_PATH_LITERAL("content_shell.pak")); |
|
jochen (gone - plz use gerrit)
2014/09/03 08:26:37
does this target depend on whatever target creates
vivekg
2014/09/03 08:55:16
Oh thats a good catch. Its not depending on the co
| |
| 30 data_pack_.LoadFromPath(content_resources_pack_path); | 28 data_pack_.LoadFromPath(content_shell_pack_path); |
| 31 #endif | |
| 32 } | 29 } |
| 33 | 30 |
| 34 TestContentClient::~TestContentClient() { | 31 TestContentClient::~TestContentClient() { |
| 35 } | 32 } |
| 36 | 33 |
| 37 std::string TestContentClient::GetUserAgent() const { | 34 std::string TestContentClient::GetUserAgent() const { |
| 38 return std::string("TestContentClient"); | 35 return std::string("TestContentClient"); |
| 39 } | 36 } |
| 40 | 37 |
| 41 base::StringPiece TestContentClient::GetDataResource( | 38 base::StringPiece TestContentClient::GetDataResource( |
| 42 int resource_id, | 39 int resource_id, |
| 43 ui::ScaleFactor scale_factor) const { | 40 ui::ScaleFactor scale_factor) const { |
| 44 base::StringPiece resource; | 41 base::StringPiece resource; |
| 45 data_pack_.GetStringPiece(resource_id, &resource); | 42 data_pack_.GetStringPiece(resource_id, &resource); |
| 46 return resource; | 43 return resource; |
| 47 } | 44 } |
| 48 | 45 |
| 49 } // namespace content | 46 } // namespace content |
| OLD | NEW |