Skip to content

Commit

Permalink
Merge pull request #126 from OBITORASU/vivaldi
Browse files Browse the repository at this point in the history
Vivaldi Support Added
  • Loading branch information
Samyak2 committed Jan 25, 2021
2 parents a10cfbd + 691cc13 commit 7927531
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
24 changes: 22 additions & 2 deletions browser_history/browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class Chrome(ChromiumBasedBrowser):

name = "Chrome"

linux_path = ".config/google-chrome"
windows_path = "AppData/Local/Google/Chrome/User Data"
mac_path = "Library/Application Support/Google/Chrome/"
linux_path = ".config/google-chrome"

profile_support = True

Expand All @@ -62,8 +62,8 @@ class Firefox(Browser):

name = "Firefox"

windows_path = "AppData/Roaming/Mozilla/Firefox/Profiles"
linux_path = ".mozilla/firefox"
windows_path = "AppData/Roaming/Mozilla/Firefox/Profiles"
mac_path = "Library/Application Support/Firefox/Profiles/"

profile_support = True
Expand Down Expand Up @@ -239,3 +239,23 @@ class Brave(ChromiumBasedBrowser):
windows_path = "AppData/Local/BraveSoftware/Brave-Browser/User Data"

profile_support = True


class Vivaldi(ChromiumBasedBrowser):
"""Vivaldi Browser
Supported platforms (TODO: Add Mac OS support)
* Linux
* Windows
Profile support: Yes
"""

name = "Vivaldi"

linux_path = ".config/vivaldi"
mac_path = "Library/Application Support/Vivaldi"
windows_path = "AppData/Local/Vivaldi/User Data"

profile_support = True
43 changes: 43 additions & 0 deletions tests/test_browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,3 +410,46 @@ def test_brave_windows(become_windows, change_homedir): # noqa: F811
"https://www.reddit.com/",
),
)


def test_vivaldi_mac(become_mac, change_homedir): # noqa: F811
"""Test history is correct on Vivaldi for MacOS"""
f = browser_history.browsers.Vivaldi()
output = f.fetch_history()
his = output.histories
assert len(his) == 2
profs = f.profiles(f.history_file)
assert len(profs) == 1
# check first and last item to ensure both profiles are searched
assert_histories_equal(
his[0],
(
datetime.datetime(
2021,
1,
25,
14,
25,
3,
tzinfo=datetime.timezone(datetime.timedelta(seconds=19800), "IST"),
),
"https://vivaldi.com/whats-new-in-vivaldi-3-5/",
),
)

his = f.history_profiles(["Profile 1"]).histories
assert_histories_equal(
his[1],
(
datetime.datetime(
2021,
1,
25,
14,
25,
27,
tzinfo=datetime.timezone(datetime.timedelta(seconds=19800), "IST"),
),
"https://pesos.github.io/",
),
)
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"OperaGX",
"Brave",
]
INVALID_BROWSER_ARGS = ["vivaldi", "explorer", "ie", "netscape", "none", "brr"]
INVALID_BROWSER_ARGS = ["explorer", "ie", "netscape", "none", "brr"]
VALID_FORMAT_ARGS = [
"infer",
"csv",
Expand Down
Binary file not shown.

0 comments on commit 7927531

Please sign in to comment.