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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 2630583002: Add setting to isolate zoom changes by default. (Closed)
Patch Set: Add more tests. Created 3 years, 11 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
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/public/test/mock_render_process_host.h" 46 #include "content/public/test/mock_render_process_host.h"
47 #include "content/public/test/test_browser_context.h" 47 #include "content/public/test/test_browser_context.h"
48 #include "content/public/test/test_utils.h" 48 #include "content/public/test/test_utils.h"
49 #include "content/test/test_content_browser_client.h" 49 #include "content/test/test_content_browser_client.h"
50 #include "content/test/test_content_client.h" 50 #include "content/test/test_content_client.h"
51 #include "content/test/test_render_frame_host.h" 51 #include "content/test/test_render_frame_host.h"
52 #include "content/test/test_render_view_host.h" 52 #include "content/test/test_render_view_host.h"
53 #include "content/test/test_web_contents.h" 53 #include "content/test/test_web_contents.h"
54 #include "net/test/cert_test_util.h" 54 #include "net/test/cert_test_util.h"
55 #include "net/test/test_data_directory.h" 55 #include "net/test/test_data_directory.h"
56 #include "testing/gmock/include/gmock/gmock.h"
56 #include "testing/gtest/include/gtest/gtest.h" 57 #include "testing/gtest/include/gtest/gtest.h"
57 #include "third_party/skia/include/core/SkColor.h" 58 #include "third_party/skia/include/core/SkColor.h"
58 #include "url/url_constants.h" 59 #include "url/url_constants.h"
59 60
60 namespace content { 61 namespace content {
61 namespace { 62 namespace {
62 63
63 class TestInterstitialPage; 64 class TestInterstitialPage;
64 65
65 class TestInterstitialPageDelegate : public InterstitialPageDelegate { 66 class TestInterstitialPageDelegate : public InterstitialPageDelegate {
(...skipping 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 3440
3440 // An automatic navigation. 3441 // An automatic navigation.
3441 main_test_rfh()->SendNavigateWithModificationCallback( 3442 main_test_rfh()->SendNavigateWithModificationCallback(
3442 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); 3443 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture));
3443 3444
3444 EXPECT_EQ(1u, dialog_manager.reset_count()); 3445 EXPECT_EQ(1u, dialog_manager.reset_count());
3445 3446
3446 contents()->SetJavaScriptDialogManagerForTesting(nullptr); 3447 contents()->SetJavaScriptDialogManagerForTesting(nullptr);
3447 } 3448 }
3448 3449
3450 namespace {
3451
3452 class MockWebContentsObserver : public WebContentsObserver {
3453 public:
3454 explicit MockWebContentsObserver(WebContents* web_contents)
3455 : WebContentsObserver(web_contents) {}
3456 MOCK_METHOD2(
3457 WebContentsReplaced,
3458 void(WebContents* old_web_contents, WebContents* new_web_contents));
3459 };
3460
3461 } // namespace
3462
3463 // Makes sure that when a WebContents is replaced, it notifies its observers.
3464 TEST_F(WebContentsImplTest, NotifiesOnReplacement) {
3465 WebContents* other_contents = contents()->Clone();
3466
3467 MockWebContentsObserver observer(contents());
3468 EXPECT_CALL(observer, WebContentsReplaced(contents(), other_contents));
3469 contents()->OnReplaced(other_contents);
3470
3471 delete other_contents;
3472 }
3473
3449 } // namespace content 3474 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698