Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" | |
| 6 | |
| 7 #include "chrome/browser/prefs/pref_service.h" | |
| 8 #include "chrome/browser/ui/browser.h" | |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
| 10 #include "chrome/common/pref_names.h" | |
| 11 #include "chrome/common/url_constants.h" | |
| 12 #include "chrome/test/base/in_process_browser_test.h" | |
| 13 #include "chrome/test/base/testing_profile.h" | |
| 14 #include "chrome/test/base/ui_test_utils.h" | |
| 15 #include "content/public/browser/web_contents.h" | |
| 16 #include "content/public/browser/web_ui.h" | |
| 17 #include "content/public/test/browser_test_utils.h" | |
| 18 #include "googleurl/src/gurl.h" | |
| 19 #include "testing/gmock/include/gmock/gmock.h" | |
| 20 | |
| 21 using ::testing::_; | |
| 22 | |
| 23 class NewTabPageSyncHandlerBrowserTest : public InProcessBrowserTest { | |
|
sail
2013/02/08 20:18:57
If this class doesn't do anything then just do:
Adrian Kuegel
2013/02/11 16:47:30
Done.
| |
| 24 public: | |
| 25 NewTabPageSyncHandlerBrowserTest() {} | |
| 26 }; | |
| 27 | |
| 28 class NewTabPageSyncHandlerTest : public NewTabPageSyncHandler { | |
|
sail
2013/02/08 20:18:57
I think names ending in Test are mostly reserved f
Adrian Kuegel
2013/02/11 16:47:30
Done.
| |
| 29 public: | |
| 30 MOCK_METHOD3(SendSyncMessageToPage, void(MessageType type, std::string msg, | |
| 31 std::string linktext)); | |
| 32 void SetWaitingForInitialPageLoad(bool waiting) { | |
| 33 waiting_for_initial_page_load_ = waiting; | |
| 34 } | |
| 35 MessageType GetHideType() { | |
| 36 return HIDE; | |
| 37 } | |
| 38 }; | |
| 39 | |
| 40 IN_PROC_BROWSER_TEST_F(NewTabPageSyncHandlerBrowserTest, | |
| 41 ChangeSigninAllowedToFalse) { | |
|
sail
2013/02/08 20:18:57
move beneath the "N" for NewTab
Adrian Kuegel
2013/02/11 16:47:30
Done.
| |
| 42 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | |
| 43 content::WebUI* web_ui = | |
| 44 browser()->tab_strip_model()->GetActiveWebContents()->GetWebUI(); | |
| 45 NewTabPageSyncHandlerTest* mock_handler = new NewTabPageSyncHandlerTest(); | |
| 46 mock_handler->SetWaitingForInitialPageLoad(false); | |
| 47 web_ui->AddMessageHandler(mock_handler); | |
| 48 EXPECT_CALL(*mock_handler, SendSyncMessageToPage( | |
| 49 mock_handler->GetHideType(), _, _)); | |
| 50 browser()->profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | |
| 51 } | |
| OLD | NEW |