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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 #include "chrome/renderer/content_settings_observer.h" | 8 #include "chrome/renderer/content_settings_observer.h" |
9 #include "chrome/test/base/chrome_render_view_test.h" | 9 #include "chrome/test/base/chrome_render_view_test.h" |
10 #include "components/content_settings/core/common/content_settings.h" | 10 #include "components/content_settings/core/common/content_settings.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 .utf8() | 383 .utf8() |
384 .find("JS_ENABLED")); | 384 .find("JS_ENABLED")); |
385 EXPECT_EQ( | 385 EXPECT_EQ( |
386 std::string::npos, | 386 std::string::npos, |
387 blink::WebFrameContentDumper::dumpLayoutTreeAsText( | 387 blink::WebFrameContentDumper::dumpLayoutTreeAsText( |
388 GetMainFrame(), blink::WebFrameContentDumper::LayoutAsTextNormal) | 388 GetMainFrame(), blink::WebFrameContentDumper::LayoutAsTextNormal) |
389 .utf8() | 389 .utf8() |
390 .find("JS_DISABLED")); | 390 .find("JS_DISABLED")); |
391 } | 391 } |
392 | 392 |
393 // Checks that same page navigations don't update content settings for the page. | 393 // Checks that same document navigations don't update content settings for the |
394 TEST_F(ChromeRenderViewTest, ContentSettingsSamePageNavigation) { | 394 // page. |
| 395 TEST_F(ChromeRenderViewTest, ContentSettingsSameDocumentNavigation) { |
395 MockContentSettingsObserver mock_observer(view_->GetMainRenderFrame()); | 396 MockContentSettingsObserver mock_observer(view_->GetMainRenderFrame()); |
396 // Load a page which contains a script. | 397 // Load a page which contains a script. |
397 const char kHtml[] = | 398 const char kHtml[] = |
398 "<html>" | 399 "<html>" |
399 "<head>" | 400 "<head>" |
400 "<script src='data:foo'></script>" | 401 "<script src='data:foo'></script>" |
401 "</head>" | 402 "</head>" |
402 "<body>" | 403 "<body>" |
403 "</body>" | 404 "</body>" |
404 "</html>"; | 405 "</html>"; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 ContentSettingPatternSource( | 516 ContentSettingPatternSource( |
516 ContentSettingsPattern::Wildcard(), | 517 ContentSettingsPattern::Wildcard(), |
517 ContentSettingsPattern::Wildcard(), | 518 ContentSettingsPattern::Wildcard(), |
518 CONTENT_SETTING_BLOCK, | 519 CONTENT_SETTING_BLOCK, |
519 std::string(), | 520 std::string(), |
520 false)); | 521 false)); |
521 | 522 |
522 EXPECT_FALSE(observer->allowAutoplay(true)); | 523 EXPECT_FALSE(observer->allowAutoplay(true)); |
523 ::testing::Mock::VerifyAndClearExpectations(&observer); | 524 ::testing::Mock::VerifyAndClearExpectations(&observer); |
524 } | 525 } |
OLD | NEW |