This source file includes following definitions.
- weak_ptr_factory_
- MakeBubble
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "chrome/browser/ui/gtk/one_click_signin_bubble_gtk.h"
#include <gtk/gtk.h>
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
class OneClickSigninBubbleGtkTest : public InProcessBrowserTest {
public:
OneClickSigninBubbleGtkTest()
: bubble_(NULL),
weak_ptr_factory_(this) {
start_sync_callback_ = base::Bind(&OneClickSigninBubbleGtkTest::OnStartSync,
weak_ptr_factory_.GetWeakPtr());
}
virtual OneClickSigninBubbleGtk* MakeBubble(
BrowserWindow::OneClickSigninBubbleType bubbleType) {
return new OneClickSigninBubbleGtk(
static_cast<BrowserWindowGtk*>(browser()->window()),
bubbleType,
base::string16(),
base::string16(),
start_sync_callback_);
}
MOCK_METHOD1(OnStartSync, void(OneClickSigninSyncStarter::StartSyncMode));
protected:
BrowserWindow::StartSyncCallback start_sync_callback_;
OneClickSigninBubbleGtk* bubble_;
base::WeakPtrFactory<OneClickSigninBubbleGtkTest> weak_ptr_factory_;
};
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndOK) {
EXPECT_CALL(*this, OnStartSync(
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS)).Times(1);
MakeBubble(
BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)->OnClickOK(NULL);
}
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndUndo) {
EXPECT_CALL(*this, OnStartSync(
OneClickSigninSyncStarter::UNDO_SYNC)).Times(1);
MakeBubble(BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)
->OnClickUndo(NULL);
}
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndClickAdvanced){
EXPECT_CALL(*this,
OnStartSync(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST)).
Times(1);
MakeBubble(BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)
->OnClickAdvancedLink(NULL);
}
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndClose) {
EXPECT_CALL(*this, OnStartSync(
OneClickSigninSyncStarter::UNDO_SYNC)).Times(1);
MakeBubble(
BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)->bubble_->Close();
}
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, BubbleShowAndOK) {
EXPECT_CALL(*this, OnStartSync(
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS)).Times(0);
MakeBubble(
BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE)->OnClickOK(NULL);
}
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, BubbleShowAndClickAdvanced){
EXPECT_CALL(*this, OnStartSync(
OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST)).Times(0);
MakeBubble(BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE)
->OnClickAdvancedLink(NULL);
}
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, BubbleShowAndClose) {
EXPECT_CALL(*this, OnStartSync(
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS)).Times(0);
MakeBubble(
BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE)->bubble_->Close();
}