Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Revert "Merge pull request #9480 from cezaraugusto/about/firstrun"
Browse files Browse the repository at this point in the history
This reverts commit cf6e22f, reversing
changes made to 9c10fa7.
  • Loading branch information
cezaraugusto committed Jun 28, 2017
1 parent 27b0547 commit 5e11b16
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 192 deletions.
20 changes: 0 additions & 20 deletions app/browser/reducers/aboutWelcomeReducer.js

This file was deleted.

20 changes: 1 addition & 19 deletions app/browser/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const {cleanupWebContents, currentWebContents, getWebContents, updateWebContents
const {FilterOptions} = require('ad-block')
const {isResourceEnabled} = require('../filtering')
const autofill = require('../autofill')
const l10n = require('../../js/l10n')

let currentPartitionNumber = 0
const incrementPartitionNumber = () => ++currentPartitionNumber
Expand Down Expand Up @@ -180,7 +179,6 @@ const updateAboutDetails = (tab, tabValue) => {
const autofillAddresses = appState.getIn(['autofill', 'addresses'])
const versionInformation = appState.getIn(['about', 'brave', 'versionInformation'])
const aboutDetails = tabValue.get('aboutDetails')

// TODO(bridiver) - convert this to an action
if (url === 'about:preferences#payments') {
tab.on('destroyed', () => {
Expand Down Expand Up @@ -658,10 +656,7 @@ const api = {
return true
},

create: (createProperties, cb = null, isRestore = false, skipIfTest = true) => {
const appState = appStore.getState()
let shouldShowWelcomeScreen = appState.getIn(['about', 'welcome', 'showOnLoad'])

create: (createProperties, cb = null, isRestore = false) => {
setImmediate(() => {
const {safeBrowsingInstance} = require('../adBlock')
createProperties = makeImmutable(createProperties).toJS()
Expand All @@ -678,19 +673,6 @@ const api = {
}
if (!createProperties.url) {
createProperties.url = newFrameUrl()
// don't open welcome screen for general tests
if (skipIfTest && process.env.NODE_ENV === 'test') {
shouldShowWelcomeScreen = false
}
if (shouldShowWelcomeScreen !== false) {
appActions.createTabRequested({
url: 'about:welcome',
// avoid chrome-extension title
// while page's title is not fetch
title: l10n.translation('aboutWelcome')
})
appActions.activateWelcomeScreen(false)
}
}
createProperties.url = normalizeUrl(createProperties.url)
// TODO(bridiver) - this should be in filtering
Expand Down
3 changes: 0 additions & 3 deletions app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,6 @@ module.exports.defaultAppState = () => {
sites: topSites,
ignoredTopSites: [],
pinnedTopSites: pinnedTopSites
},
welcome: {
showOnLoad: true
}
},
trackingProtection: {
Expand Down
11 changes: 0 additions & 11 deletions docs/appActions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1142,17 +1142,6 @@ Clear temp setting for clear browsing data



### activateWelcomeScreen(shouldShowWelcomeScreen)

Dispatches a message to the store to show the welcome screen.

**Parameters**

**shouldShowWelcomeScreen**: `Boolean`, true if a new tab
with the welcome screen should be show




* * *

Expand Down
13 changes: 0 additions & 13 deletions js/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1455,19 +1455,6 @@ const appActions = {
dispatch({
actionType: appConstants.APP_ON_CANCEL_BROWSING_DATA
})
},

/**
* Dispatches a message to the store to show the welcome screen.
*
* @param {Boolean} shouldShowWelcomeScreen - true if a new tab
* with the welcome screen should be show
*/
activateWelcomeScreen: function (activateWelcomeScreen) {
dispatch({
actionType: appConstants.APP_ACTIVATE_WELCOME_SCREEN,
activateWelcomeScreen
})
}
}

Expand Down
1 change: 0 additions & 1 deletion js/constants/appConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ const appConstants = {
APP_ON_GO_TO_INDEX: _,
APP_ON_GO_BACK_LONG: _,
APP_ON_GO_FORWARD_LONG: _,
APP_ACTIVATE_WELCOME_SCREEN: _,
APP_AUTOPLAY_BLOCKED: _,
APP_SAVE_PASSWORD: _,
APP_UPDATE_PASSWORD: _,
Expand Down
1 change: 0 additions & 1 deletion js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ const handleAppAction = (action) => {
require('../../app/browser/reducers/extensionsReducer'),
require('../../app/browser/reducers/shareReducer'),
require('../../app/browser/reducers/updatesReducer'),
require('../../app/browser/reducers/aboutWelcomeReducer'),
require('../../app/ledger').doAction
]
initialized = true
Expand Down
38 changes: 0 additions & 38 deletions test/unit/app/browser/reducers/aboutWelcomeReducerTest.js

This file was deleted.

96 changes: 17 additions & 79 deletions test/unit/app/browser/tabsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fakeAdBlock = require('../../lib/fakeAdBlock')

require('../../braveUnit')

describe('tabs API unit tests', function () {
describe('tabs API', function () {
let tabs, appActions
before(function () {
mockery.enable({
Expand Down Expand Up @@ -59,28 +59,9 @@ describe('tabs API unit tests', function () {
}]
})

this.appState = {
about: {
welcome: {
showOnLoad: true
}
}
}

this.appStore = {
getState: () => Immutable.fromJS(this.appState)
}

mockery.registerMock('electron', fakeElectron)
mockery.registerMock('ad-block', fakeAdBlock)
mockery.registerMock('leveldown', {})
mockery.registerMock('../../js/stores/appStore', this.appStore)
mockery.registerMock('../../js/l10n', {
translation: (word) => word
})
mockery.registerMock('../filtering', {
isResourceEnabled: (resourceName, url, isPrivate) => false
})

mockery.registerMock('./webContentsCache', {
getWebContents: (tabId) => {
Expand Down Expand Up @@ -109,17 +90,25 @@ describe('tabs API unit tests', function () {
appActions = require('../../../../js/actions/appActions')
})

beforeEach(function () {
this.newWindowSpy = sinon.spy(appActions, 'newWindow')
this.newWebContentsAddedSpy = sinon.spy(appActions, 'newWebContentsAdded')
})

after(function () {
mockery.disable()
})

afterEach(function () {
this.tabWithDevToolsClosed.openDevTools.reset()
this.tabWithDevToolsClosed.closeDevTools.reset()
this.tabWithDevToolsOpened.openDevTools.reset()
this.tabWithDevToolsOpened.closeDevTools.reset()
this.newWindowSpy.restore()
this.newWebContentsAddedSpy.restore()
})

describe('toggleDevTools', function () {
afterEach(function () {
this.tabWithDevToolsClosed.openDevTools.reset()
this.tabWithDevToolsClosed.closeDevTools.reset()
this.tabWithDevToolsOpened.openDevTools.reset()
this.tabWithDevToolsOpened.closeDevTools.reset()
})
it('opens dev tools if closed', function () {
tabs.toggleDevTools(1)
assert(this.tabWithDevToolsClosed.openDevTools.calledOnce)
Expand All @@ -141,7 +130,6 @@ describe('tabs API unit tests', function () {
assert(this.tabWithDevToolsOpenedAndFocused.closeDevTools.notCalled)
})
})

describe('isDevToolsFocused', function () {
it('returns false if devtools are opened but not focused', function () {
assert.equal(tabs.isDevToolsFocused(1), false)
Expand All @@ -153,21 +141,12 @@ describe('tabs API unit tests', function () {
assert.equal(tabs.isDevToolsFocused(3), true)
})
})

describe('moveTo', function () {
before(function () {
this.browserOpts = {
positionByMouseCursor: true
}
})
beforeEach(function () {
this.newWindowSpy = sinon.spy(appActions, 'newWindow')
this.newWebContentsAddedSpy = sinon.spy(appActions, 'newWebContentsAdded')
})
afterEach(function () {
this.newWindowSpy.restore()
this.newWebContentsAddedSpy.restore()
})
it('moves tab to a new window', function () {
const state = this.state.set('dragData', Immutable.fromJS({
windowId: 1,
Expand Down Expand Up @@ -339,49 +318,8 @@ describe('tabs API unit tests', function () {
})
})

describe('create', function () {
before(function () {
this.clock = sinon.useFakeTimers()
this.createTabRequestedSpy = sinon.spy(appActions, 'createTabRequested')
this.activateWelcomeScreenSpy = sinon.spy(appActions, 'activateWelcomeScreen')
this.extensionsCreateTabSpy = sinon.spy(fakeElectron.extensions, 'createTab')
})

after(function () {
this.clock.restore()
this.createTabRequestedSpy.restore()
this.activateWelcomeScreenSpy.restore()
this.extensionsCreateTabSpy.restore()
})

const createProperties = Immutable.fromJS({})
const cb = null
const isRestore = false
const skipIfTest = false

describe('when createProperties.url is not set', function () {
it('calls appActions.createTabRequested', function () {
this.createTabRequestedSpy.reset()
tabs.create(createProperties, cb, isRestore, skipIfTest)
this.clock.tick(1510)
assert.equal(this.createTabRequestedSpy.calledOnce, true)
})

describe('when welcome screen has not shown yet', function () {
it('calls appActions.activateWelcomeScreen if state is true', function () {
this.activateWelcomeScreenSpy.reset()
tabs.create(createProperties, cb, isRestore, skipIfTest)
this.clock.tick(1510)
assert.equal(this.activateWelcomeScreenSpy.calledOnce, true)
})
})
})

it('calls electron.extensions.createTab', function () {
this.extensionsCreateTabSpy.reset()
tabs.create(createProperties, cb, isRestore, skipIfTest)
this.clock.tick(1510)
assert.equal(this.extensionsCreateTabSpy.calledOnce, true)
describe.skip('create', function () {
it('todo', function () {
})
})

Expand Down
4 changes: 0 additions & 4 deletions test/unit/app/sessionStoreTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,10 +854,6 @@ describe('sessionStore unit tests', function () {
})

describe('defaultAppState', function () {
it('sets showOnLoad to true (which triggers about:welcome)', function () {
const defaultAppState = sessionStore.defaultAppState()
assert.equal(defaultAppState.about.welcome.showOnLoad, true)
})
})

describe('isProtocolHandled', function () {
Expand Down
3 changes: 0 additions & 3 deletions test/unit/lib/fakeElectron.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ const fakeElectron = {
defaultSession: {
partition: 'default'
}
},
extensions: {
createTab: function () {}
}
}

Expand Down

0 comments on commit 5e11b16

Please sign in to comment.