gpu: Tweak Android WebGL test expectations
[chromium-blink-merge.git] / chrome_frame / test / simple_resource_loader_test.cc
blob37070e3a7b60bc2775e506009fa3ef22e65812d8
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
3 // found in the LICENSE file.
5 #include "chrome_frame/simple_resource_loader.h"
7 #include "base/files/file_path.h"
8 #include "base/win/windows_version.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/resource/data_pack.h"
12 TEST(SimpleResourceLoaderTest, LoadLocaleDll) {
13 std::vector<std::wstring> language_tags;
14 base::FilePath locales_path;
15 base::FilePath file_path;
16 HMODULE dll_handle = NULL;
18 SimpleResourceLoader::DetermineLocalesDirectory(&locales_path);
20 // Test valid language-region string:
21 language_tags.clear();
22 language_tags.push_back(L"en-GB");
23 language_tags.push_back(L"en");
24 ui::DataPack* data_pack = NULL;
26 std::wstring language;
28 EXPECT_TRUE(
29 SimpleResourceLoader::LoadLocalePack(language_tags, locales_path,
30 &dll_handle, &data_pack,
31 &language));
32 if (NULL != dll_handle) {
33 FreeLibrary(dll_handle);
34 dll_handle = NULL;
36 EXPECT_TRUE(data_pack != NULL);
37 delete data_pack;
38 data_pack = NULL;
40 EXPECT_EQ(language, L"en-GB");
41 language.clear();
43 // Test valid language-region string for which we only have a language dll:
44 language_tags.clear();
45 language_tags.push_back(L"fr-FR");
46 language_tags.push_back(L"fr");
47 EXPECT_TRUE(
48 SimpleResourceLoader::LoadLocalePack(language_tags, locales_path,
49 &dll_handle, &data_pack,
50 &language));
51 if (NULL != dll_handle) {
52 FreeLibrary(dll_handle);
53 dll_handle = NULL;
55 EXPECT_TRUE(data_pack != NULL);
56 delete data_pack;
57 data_pack = NULL;
59 EXPECT_EQ(language, L"fr");
60 language.clear();
62 // Test invalid language-region string, make sure fallback works:
63 language_tags.clear();
64 language_tags.push_back(L"xx-XX");
65 language_tags.push_back(L"en-US");
66 EXPECT_TRUE(
67 SimpleResourceLoader::LoadLocalePack(language_tags, locales_path,
68 &dll_handle, &data_pack,
69 &language));
70 if (NULL != dll_handle) {
71 FreeLibrary(dll_handle);
72 dll_handle = NULL;
75 EXPECT_TRUE(data_pack != NULL);
76 delete data_pack;
77 data_pack = NULL;
79 EXPECT_EQ(language, L"en-US");
80 language.clear();
83 TEST(SimpleResourceLoaderTest, InstanceTest) {
84 SimpleResourceLoader* loader = SimpleResourceLoader::GetInstance();
86 ASSERT_TRUE(NULL != loader);
87 ASSERT_TRUE(NULL != loader->GetResourceModuleHandle());