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

Side by Side Diff: chrome_frame/test/util_unittests.cc

Issue 8344004: base/win: Add documentation to RegKey::Read/Write functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indentation Created 9 years, 2 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 (c) 2011 The Chromium Authors. All rights reserved. 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 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/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_version_info.h" 6 #include "base/file_version_info.h"
7 #include "base/file_version_info_win.h" 7 #include "base/file_version_info_win.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/win/registry.h" 10 #include "base/win/registry.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 for (int i = 0; i < arraysize(urls); ++i) { 412 for (int i = 0; i < arraysize(urls); ++i) {
413 EXPECT_TRUE(CanNavigate(GURL(urls[i]), &mock)); 413 EXPECT_TRUE(CanNavigate(GURL(urls[i]), &mock));
414 } 414 }
415 } 415 }
416 416
417 TEST_F(UtilTests, IsDefaultRendererTest) { 417 TEST_F(UtilTests, IsDefaultRendererTest) {
418 RegKey config_key(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_ALL_ACCESS); 418 RegKey config_key(HKEY_CURRENT_USER, kChromeFrameConfigKey, KEY_ALL_ACCESS);
419 EXPECT_TRUE(config_key.Valid()); 419 EXPECT_TRUE(config_key.Valid());
420 420
421 DWORD saved_default_renderer = 0; // NOLINT 421 DWORD saved_default_renderer = 0; // NOLINT
422 config_key.ReadValueDW(kEnableGCFRendererByDefault, &saved_default_renderer); 422 config_key.ReadValue(kEnableGCFRendererByDefault, &saved_default_renderer);
423 423
424 config_key.DeleteValue(kEnableGCFRendererByDefault); 424 config_key.DeleteValue(kEnableGCFRendererByDefault);
425 EXPECT_FALSE(IsGcfDefaultRenderer()); 425 EXPECT_FALSE(IsGcfDefaultRenderer());
426 426
427 config_key.WriteValue(kEnableGCFRendererByDefault, static_cast<DWORD>(0)); 427 config_key.WriteValue(kEnableGCFRendererByDefault, static_cast<DWORD>(0));
428 EXPECT_FALSE(IsGcfDefaultRenderer()); 428 EXPECT_FALSE(IsGcfDefaultRenderer());
429 429
430 config_key.WriteValue(kEnableGCFRendererByDefault, static_cast<DWORD>(1)); 430 config_key.WriteValue(kEnableGCFRendererByDefault, static_cast<DWORD>(1));
431 EXPECT_TRUE(IsGcfDefaultRenderer()); 431 EXPECT_TRUE(IsGcfDefaultRenderer());
432 432
(...skipping 10 matching lines...) Expand all
443 KEY_ALL_ACCESS); 443 KEY_ALL_ACCESS);
444 EXPECT_TRUE(opt_for_host.Valid()); 444 EXPECT_TRUE(opt_for_host.Valid());
445 if (!config_key.Valid() || !opt_for_gcf.Valid() || !opt_for_host.Valid()) 445 if (!config_key.Valid() || !opt_for_gcf.Valid() || !opt_for_host.Valid())
446 return; 446 return;
447 447
448 const wchar_t kTestFilter[] = L"*.testing.chromium.org"; 448 const wchar_t kTestFilter[] = L"*.testing.chromium.org";
449 const wchar_t kTestUrl[] = L"www.testing.chromium.org"; 449 const wchar_t kTestUrl[] = L"www.testing.chromium.org";
450 450
451 // Save the current state of the registry. 451 // Save the current state of the registry.
452 DWORD saved_default_renderer = 0; 452 DWORD saved_default_renderer = 0;
453 config_key.ReadValueDW(kEnableGCFRendererByDefault, &saved_default_renderer); 453 config_key.ReadValue(kEnableGCFRendererByDefault, &saved_default_renderer);
454 454
455 // Make sure the host is the default renderer. 455 // Make sure the host is the default renderer.
456 config_key.WriteValue(kEnableGCFRendererByDefault, static_cast<DWORD>(0)); 456 config_key.WriteValue(kEnableGCFRendererByDefault, static_cast<DWORD>(0));
457 EXPECT_FALSE(IsGcfDefaultRenderer()); 457 EXPECT_FALSE(IsGcfDefaultRenderer());
458 458
459 opt_for_gcf.DeleteValue(kTestFilter); // Just in case this exists 459 opt_for_gcf.DeleteValue(kTestFilter); // Just in case this exists
460 EXPECT_EQ(RENDERER_TYPE_UNDETERMINED, RendererTypeForUrl(kTestUrl)); 460 EXPECT_EQ(RENDERER_TYPE_UNDETERMINED, RendererTypeForUrl(kTestUrl));
461 opt_for_gcf.WriteValue(kTestFilter, L""); 461 opt_for_gcf.WriteValue(kTestFilter, L"");
462 EXPECT_EQ(RENDERER_TYPE_CHROME_OPT_IN_URL, RendererTypeForUrl(kTestUrl)); 462 EXPECT_EQ(RENDERER_TYPE_CHROME_OPT_IN_URL, RendererTypeForUrl(kTestUrl));
463 463
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 535
536 ASSERT_EQ(expect_match, 536 ASSERT_EQ(expect_match,
537 CheckXUaCompatibleDirective(test.header_value, 537 CheckXUaCompatibleDirective(test.header_value,
538 all_versions[version_index])) 538 all_versions[version_index]))
539 << "Expect '" << test.header_value << "' to " 539 << "Expect '" << test.header_value << "' to "
540 << (expect_match ? "match" : "not match") << " IE major version " 540 << (expect_match ? "match" : "not match") << " IE major version "
541 << all_versions[version_index]; 541 << all_versions[version_index];
542 } 542 }
543 } 543 }
544 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698